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!
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
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('')){
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
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!
Yes, that works.
Cheers!
Josue