Archived topic
Remove page Hero on Page Template with PHP
7 replies · Started by gregoirenoyelle on July 3, 2019
Hi !
Is-there a filter to remove page hero with PHP (without CSS) on some Page Template?
Thanks.
Grégoire
Hi there,
You should be able to Exclusion rules under display rules:
https://docs.generatepress.com/article/header-element-overview/#display-rules
Let me know if this helps :)
Hi Leo,
Thanks for your message.
I need to have this filter in my template (child theme).
For Exclusion rules, my page template do not show up. In my page, I can see the template.
Cheers,
That case this should help:
https://docs.generatepress.com/article/generate_header_element_display/
You can search generate_header_element_display in this forum for some more examples.
Let me know :)
Thanks Leo
I will try tomorrow and I’ll keep you informed.
Cheers
Sounds good :)
Hi Leo
I try this. I give you the process more the others :)
My page template name is page-temp-test.php. I put this code in the functions.php file of my child theme.
add_filter( 'generate_header_element_display', function( $display ) {
if ( is_page_template( 'page-temp-test.php') ) {
$display = false;
}
return $display;
} );
It works great.
Thanks !!
Cheers
Awesome!
Thanks for sharing the solution :)