Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #388092

    Hi! Thank you for the theme! we were wondering if we could have a custom header for each woocommerce product category? We were able to add a header via custom header plugin here: https://aquaquestonline.com/product-category/backpacks/ but we really wanted it to be starting from the very top of the page like in Geode demo.

    Thanks,
    Gear Out Here

    • This topic was modified 9 years, 9 months ago by Andy.
    #388649

    Hi gearouthere!

    did you try one of these plugins?
    https://wordpress.org/plugins/custom-header-extended/
    https://wordpress.org/plugins/custom-header-images/

    Best regards,
    Andy

    #389599

    Hi Andy, thanks for your reply! Those are both for adding header to post (not woocommerce product category) and the first one doesn’t work with WordPress 4.1 .. I was wondering if there was a solution we could implement through the theme to enable a header on the woo-commerce product category page?…

    #390676

    Hi!

    You can put something like this on functions.php:

    function ava_product_category_banner() {
    	if(has_term('artifact', 'product_cat')) {
    		echo "<div class='product_category_banner container_wrap'>ARTIFACT IMAGE HERE</div>";
    	} 
    	else if(has_term('treasure', 'product_cat')) {
    		echo "<div class='product_category_banner container_wrap'>TREASURE IMAGE HERE</div>";
    	}
    }

    Add the link to the image then change the product category. Below, add this:

    add_action('wp_footer', 'ava_product_category', 5);
    function ava_product_category(){
    ?>
    <script>
    (function($){
        $(window).load(function() {
    		$('.product_category_banner').css('opacity', 1);
    		$('.product_category_banner').prependTo('.container_wrap.template-shop');
        });
    })(jQuery);
    </script>
    <?php
    }

    Go to Enfold > General Styling > Quick CSS field, add this:

    .product_category_banner {
    opacity: 0;;
    height: 100px;
    border-bottom: 1px solid gray;
    background: red;
    }

    You’ll have a fullwidth container on top of the product category page. All you need to do is to adjust the styling and add the images.

    Regards,
    Ismael

    #390889

    Hi Ismael, thank you so much for your help!! . I added the code but it didn’t seem to change anything. (I added to functions.php the following:

    /* adding header for category pages*/

    function ava_product_category_banner() {
    if(has_term(‘Backpacks’, ‘product_cat’)) {
    echo “<div class=’product_category_banner container_wrap’>http://aquaquestonline.com/wp-content/uploads/2014/04/kayakbetter.jpg</div>&#8221;;
    }
    else if(has_term(‘Tarps’, ‘product_cat’)) {
    echo “<div class=’product_category_banner container_wrap’>http://aquaquestonline.com/wp-content/uploads/2014/04/kayakbetter.jpg</div>&#8221;;
    }
    }

    add_action(‘wp_footer’, ‘ava_product_category’, 5);
    function ava_product_category(){
    ?>
    <script>
    (function($){
    $(window).load(function() {
    $(‘.product_category_banner’).css(‘opacity’, 1);
    $(‘.product_category_banner’).prependTo(‘.container_wrap.template-shop’);
    });
    })(jQuery);
    </script>
    <?php
    }

    I added the CSS you advised as well.. Maybe I am doing something wrong?

    Thanks so much,

    Gear Out Here

    #391902

    Hi!

    Instead of the term name, please use the term id.

    function ava_product_category_banner() {
    	if(has_term('26', 'product_cat')) {
    		echo "<div class='product_category_banner container_wrap'><img src="http://aquaquestonline.com/wp-content/uploads/2014/04/kayakbetter.jpg"></div>";
    	} 
    	else if(has_term('46', 'product_cat')) {
    		echo "<div class='product_category_banner container_wrap'><img src="http://aquaquestonline.com/wp-content/uploads/2014/04/kayakbetter.jpg"></div>";
    	}
    }

    Adjust the ids above.

    Regards,
    Ismael

    #392259

    Hi Ismael,
    thanks so much for looking into this. It actually still breaks the site and gives the following error: Parse error: syntax error, unexpected T_STRING, expecting ‘,’ or ‘;’ in /nfs/c09/h04/mnt/188733/domains/aquaquestonline.com/html/wp-content/themes/enfold/functions.php on line 1088
    I have a feeling there’s maybe one sign missed but I don’t have enough php knowledge to fix it..

    Thank you,
    Gear Out Here

    #392636

    Hey!

    Try the following instead please:

    
    function ava_product_category_banner() {
    	if(has_term('26', 'product_cat')) {
    		echo '<div class="product_category_banner container_wrap"><img src="http://aquaquestonline.com/wp-content/uploads/2014/04/kayakbetter.jpg"></div>';
    	} 
    	else if(has_term('46', 'product_cat')) {
    		echo '<div class="product_category_banner container_wrap"><img src="http://aquaquestonline.com/wp-content/uploads/2014/04/kayakbetter.jpg"></div>';
    	}
    }
    

    Best regards,
    Rikard

    #428237

    Hi Guys..

    Actually we can add Image banners to product categories and archives by using the Theme Designer
    A very similar Problem to this above.

    I want to display the same long imagebanner from the category pages also on my singe products.

    I do the following:

    
    function add_banner_before_breadcrumb() {
    	if ( is_product() )
    	{
    		echo '<div id="av_product_description" class="avia-section main_color avia-section-large avia-no-border-st…verlay-active avia-bg-style-parallax container_wrap fullsize" style="color:#ffffff;" data-section-bg-repeat="stretch">
    			  <div class="av-parallax avia-full-stretch" style="background-image: url("http://sst.seite-freigeben.de/wp-content/uploads/stripe_Poducts11.jpg")";   ></div>
    		</div>';
    	}
    }
    add_action('ava_after_main_container', 'add_banner_before_breadcrumb'); 
    

    But the javascript is a bit buggy after using this. Can you help me?

    htaccess:
    user: SST
    login: Somer2015!

    #429413

    Hey!

    You can try this:

    add_action('ava_after_main_container', 'add_banner_before_breadcrumb'); 
    function add_banner_before_breadcrumb() {
    	if ( is_product() )
    	{
    		echo '<div id="av_product_description" class="avia-section main_color avia-section-default avia-no-shadow avia-full-stretch av-parallax-section avia-bg-style-parallax av-minimum-height av-minimum-height-75 container_wrap fullsize" style="color:#ffffff;" data-section-bg-repeat="stretch">
    			  <div class="av-parallax avia-full-stretch"></div>
    		</div>';
    	}
    }
    
    add_action('wp_footer', 'ava_custom_script_parallax');
    function ava_custom_script_parallax(){
    ?>
    <script>
    (function($){
      	$('#av_product_description .av-parallax').css('background-image', 'url(' + 'http://sst.seite-freigeben.de/wp-content/uploads/stripe_Poducts11.jpg' + ')');
    	$('#av_product_description').css('height', '500px');
    })(jQuery);
    </script>
    <?php
    }

    Set the height of the #av_product_description manually.

    Regards,
    Ismael

    #662358

    Hello,

    when I insert the code above in my functions.php + the CSS code changes, unfortunately, nothing. The term ids I have changed. Can I do it so translated that the products per category get all the same headers? Many thanks for your help!

    #662666

    Hi @envato1901,

    Please open a new thread and post admin login details in private so that we can have a closer look. Also try to explain your problem a bit closer so that we get an understanding of what you are looking to achieve.

    Regards,
    Rikard

Viewing 12 posts - 1 through 12 (of 12 total)
  • You must be logged in to reply to this topic.