[Resolved] blank page template? (no header/footer)

Home Forums Support [Resolved] blank page template? (no header/footer)

Home Forums Support blank page template? (no header/footer)

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #351378
    Ash

    How do I remove header and footer on certain page?
    I’d like to make page for iframe.

    P.S.
    I saw an example of removing header through hook on documentation,
    But some how is_page() condition didn’t work.

    function tu_remove_header(){
      if(is_page(111)) remove_action( 'generate_header','generate_construct_header' );
    }
    add_action( 'after_setup_theme','tu_remove_header' );
    #351400
    Leo
    Staff
    Customer Support

    Hi there,

    Can you give this a shot?

    add_action( 'after_setup_theme','tu_remove_header' );
    function tu_remove_header() { 
      if ( is_page( 125 ) ) {
          remove_action( 'generate_header','generate_construct_header' );
      }
    }
    #351401
    Ash

    Isn’t that same as mine?

    #351404
    Leo
    Staff
    Customer Support

    Hmm looks like you are missing a couple brackets?

    Can you link us to the page that’s not working?

    #351405
    Ash

    Actually bracket didn’t matter.
    Simply is_page condition does not work.
    without is_page, it works.

    #351435
    Tom
    Lead Developer
    Lead Developer

    is_page() needs to be run a bit later.

    Try this instead:

    add_action( 'wp','tu_remove_header' );
    function tu_remove_header() { 
      if ( is_page( 125 ) ) {
          remove_action( 'generate_header','generate_construct_header' );
      }
    }
    #351437
    Ash

    Worked!

    Now how do I remove footer(site-footer div)?

    #351440
    Ash

    Found
    https://generatepress.com/forums/topic/generate-press-copyright-in-footer-bar/

    remove_action( 'generate_footer','generate_construct_footer' );

    #351447
    Leo
    Staff
    Customer Support

    Try this:

    add_action( 'wp','tu_remove_footer' );
    function tu_remove_footer() {
        if ( is_page( 125 ) ) {
            remove_action( 'generate_footer','generate_construct_footer' );
        }
    }
    #351454
    Ash

    Yes I did that.
    I added both
    remove_action( ‘generate_footer’,’generate_construct_footer’ );
    and
    remove_action( ‘generate_header’,’generate_construct_header’ );
    to “wp” action.

    Thank you.

    #351501
    Tom
    Lead Developer
    Lead Developer

    Glad you got it working 🙂

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