Forums

[resolved] How to Remove header and footer from a single page? (24 posts)

  1. icec
    Member
    Posted 2 years ago #

    Hello,

    I would like to remove the header and footer from a single page.

    I have tried various options, adapting previous answers from this forum and with various combinations of scripts, but I am stuck and would really appreciate some help.

    Do I need to change the header.php or the page.php? or something else?

    Many thanks in advance.

  2. esmi
    Theme Diva & Mod
    Posted 2 years ago #

    You'd need to edit header.php and footer.php. Use the is_page() conditional to determine what is, or isn't, shown on this particular page.

  3. icec
    Member
    Posted 2 years ago #

    Thanks so much for replying. I think I was stuck on whether I needed to edit the page.php too. After hours of trying more complicated things, your answer just made it all click. Simple! I did it and it worked. Thanks so much and all the best.

  4. Shea
    Member
    Posted 2 years ago #

    If you edit header.php and footer.php, won't that affect ALL pages? How do you limit it to just one page?

  5. Shea
    Member
    Posted 2 years ago #

    So I figured out what my page_ID is, now what? What is the code to hide the header and category bar? Also, does it matter where this line of code is entered in the header.php? I assume it needs to be near the top... perhaps just below the W3 line?

    <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
    is_page('174')

    Thanks in advance for your help. :-)

    Shea

  6. Shea
    Member
    Posted 2 years ago #

    Well, I discovered that's not where it goes... ;-)

  7. alchymyth
    The Sweeper
    Posted 2 years ago #

    if you could copy the code of your header.php into a pastebin and post the link here, someone might have a look at it and might be able to help you.

  8. magickman5
    Member
    Posted 2 years ago #

    wp_list_categories('title_li='); in sidebar.php for hiding categories and wp_head header.php

  9. Shea
    Member
    Posted 2 years ago #

    Thanks for the advice. My header is here http://wordpress.pastebin.com/m542f429c

    Thanks 'magickman', but I'm not sure exactly what you mean. I found wp_head(); was I supposed to put it in the parentheses like this?

    wp_head(wp_list_categories('title_li=')) because that didn't work and in fact, put a link to my category in the header. (I said I'm a total newbie to PHP). I've asked a developer I know to take a look at it and see if he can get it to do this.

    Thanks again to both of you.

    Shea

  10. Cyberbronco
    Member
    Posted 1 year ago #

    I am trying to do the same thing: remove header from one page. Previous posters ended up answering their own questions without documenting the answers here.

    Can anyone hold my hand through this? I know how to get to the appearance editor and open the header.php file to edit it and I know my page id that i want to do this on. After that I am lost on this one.

    Thanks in advance.

    Jeff

  11. elizool99
    Member
    Posted 1 year ago #

    Jeff

    use a function that checks page's id then make a IF condition in PHP that if the page's ID isnt not the id of the page u dont want to show the so the header will be shown
    u need to type != in the IF so its says not equal because if the ID not equal to the id of the page the header will be shown

    do it in header.php

  12. Cyberbronco
    Member
    Posted 1 year ago #

    Elizool99,

    You lost me already.

    I know my page #.
    I vaguely understand what you are talking about.
    Can you give me the code and where I would write it in the header.php?

    Thanks so much for responding so quickly.

    Jeff

  13. Cyberbronco
    Member
    Posted 1 year ago #

    Here is the page I am working on. If you click on any of the gallery images below the header they will pop up behind the header image when viewed in IE. Grrrr!

    Jeff

  14. elizool99
    Member
    Posted 1 year ago #

    1.u have fatal error i cant see ur site
    2.i dont understand what do u want to do u know page id and how to edit header

  15. Cyberbronco
    Member
    Posted 1 year ago #

    Elizool99,

    You peeked while I was experimenting. Unfortunately I still cant get it working. I restored my site. It's back up.

    What I don't understand is what to write in the header.php. My page id=10.

    Can you tell me what to write and where to place it?

    Thanks so much.

    Jeff

  16. elizool99
    Member
    Posted 1 year ago #

    what to write so the header wont display on page id 10?
    if yes
    make if in php to the page id and if its equlals 10 so header wont show and else
    he will be shown

  17. Cyberbronco
    Member
    Posted 1 year ago #

    Elizool99,

    Sorry Eli. I am not as smart as you. I really need it spelled out for me with the actual code. As I said in my first post I really need the hand holding. I need to know the exact code to write and where to place it in the header.php

    Thanks for your patience,

    Jeff

  18. Cyberbronco
    Member
    Posted 1 year ago #

    Anyone else have any ideas?

    I am thoroughly confused.
    Everything I try brings down the entire site.
    Jeff

  19. Mark / t31os
    Moderator
    Posted 1 year ago #

    What exactly do you want to exclude from the header and footer, if you conditionalise them out, you'll not have a complete document, since the primary HTML markup is missing, notably the opening/closing HTML and BODY tags.

    What you should do is open up both the header.php and footer.php, and place these two pieces of code around the code you want to conditionally disable for a set page.. (1 is an example ID)

    <?php if( !is_page( '1' ) ) : ?>

    and

    <?php endif; ?>

    Which basically means, when it's not a page with the ID 1, then execute the code... (so basically it's not shown if it is page with an ID of 1).

    This is exactly what esmi was suggesting in her response.

    If you can't manage it, open the 2 files (header and footer), and paste them into individual pastebins, and post the links back here, and i'll write in the conditions for you... ;)

  20. Cyberbronco
    Member
    Posted 1 year ago #

    Here is my header.php

    This is my website.

    I want to keep the header image from displaying on my "Gallery" page.

    Jeff

  21. esmi
    Theme Diva & Mod
    Posted 1 year ago #

    Try changing:

    div id="banner">
                                                   <!-- Flashfader -->
    	               <?php include (ABSPATH.'wp-content/flashfader/flashfaderhtml.txt'); ?>
    	              <!-- /Flashfader -->
                <if(is_page_id=10) then display; none>
    
    		</div>

    to:

    <?php if( !is_page('10') ) :?>
    div id="banner">
                                                   <!-- Flashfader -->
    	               <?php include (ABSPATH.'wp-content/flashfader/flashfaderhtml.txt'); ?>
    	              <!-- /Flashfader -->
    		</div>
    <?php endif;?>
  22. Cyberbronco
    Member
    Posted 1 year ago #

    esmi,

    That is one spooky avatar and you are one smart cookie!

    Bless you!

    Thank you so much! Wow! I was not going to figure that out on my own.
    You rock!

    Jeff

  23. esmi
    Theme Diva & Mod
    Posted 1 year ago #

    Glad to hear that it's working now. :-)

  24. shearease
    Member
    Posted 1 year ago #

    Esmi!
    Seems like you solved cyberbronco's query. I think I have a similar query. my website is http://www.sheareaseltd.com I would like to remove the header above my links/navigation. Obviously I dont want to dlete all the info in the html header but I want to see what it would look like without that dopy box. Also is it possible to remove the right column?

Topic Closed

This topic has been closed to new replies.

About this Topic