[Resolved] Remove page Hero on Page Template with PHP

Home Forums Support [Resolved] Remove page Hero on Page Template with PHP

Home Forums Support Remove page Hero on Page Template with PHP

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #948040
    gregoirenoyelle

    Hi !
    Is-there a filter to remove page hero with PHP (without CSS) on some Page Template?
    Thanks.
    Grégoire

    #948116
    Leo
    Staff
    Customer Support

    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 🙂

    #948149
    gregoirenoyelle

    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,

    #948163
    Leo
    Staff
    Customer Support

    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 🙂

    #948187
    gregoirenoyelle

    Thanks Leo
    I will try tomorrow and I’ll keep you informed.
    Cheers

    #948202
    Leo
    Staff
    Customer Support

    Sounds good 🙂

    #948553
    gregoirenoyelle

    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

    #948947
    Leo
    Staff
    Customer Support

    Awesome!

    Thanks for sharing the solution 🙂

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