Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #318247

    Hi,
    I would like to add a header for all portfolio items. My problem is that if I edit the loop-portfolio-single.php or single-portfolio.php, nothing happens. I believe this is because I am using the advanced layout which uses template-builder.php, is this correct? How can I add a header for all portfolio items only, and not all pages that used the advanced layout module. Much thanks!

    #318652

    Hey!

    Try adding this at the very end of your theme / child theme functions.php file:

    function put_stuff_before_main_content() {
    if(is_single('portfolio')){	
    echo "header code here";
    }
    }
    
    add_action('ava_after_main_container', 'put_stuff_before_main_content');

    Cheers!
    Josue

    #318661

    Thank you for your reply Josue and this is promising. It is not working as written above, however, if I remove portfolio, it works. Any ideas?

    function put_stuff_before_main_content() {
    if(is_single('')){	
    
    #318663

    Hi!

    Typo by me, code should be:

    function put_stuff_before_main_content() {
    if(is_singular('portfolio')){	
    echo "header code here";
    }
    }
    
    add_action('ava_after_main_container', 'put_stuff_before_main_content');

    Regards,
    Josue

    #318668

    That works great, thank you. I am assuming that I can just create a similar function for before the footer

    function put_stuff_before_main_footer() {
    if(is_singular('portfolio')){	
    echo "pre-footer code here";
    }
    }
    
    add_action('ava_before_footer', 'put_stuff_before_main_footer');
    

    if I add something like this to the beginning of footer.php

    	<?php do_action('ava_before_footer'); ?>	
    

    Thanks again!

    #318673

    Yes, that works.

    Cheers!
    Josue

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