• Hi,

    I’m trying to remove the header of my website from the posts & pages because it’s too big and takes up the entire page. I have some basic knowledge of CSS and I’ve searched but can’t seem to find an answer. I saw in the WP Codex you can use this but that doesn’t apply to getting rid of the header so I was wondering if anyone knew how to.

    <?php
    if ( is_home() ) :
    get_header(‘home’);
    elseif ( is_404() ) :
    get_header(‘404’);
    else :
    get_header();
    endif;
    ?>

    Here’s the website: https://basedinwire.com/

    Thank you!

Viewing 6 replies - 1 through 6 (of 6 total)
  • depends on what your are defining as ‘the header’ – if you mean just the big top image, then you could try wo wrap the image code into a conditional statement similar to the one you have posted.

    alternatively, you could try to hide or shrink some parts of the header with CSS to keep at least the menu …

    the right place to ask for details would be in your theme’s forum at https://www.ads-software.com/support/theme/fortunato#postform

    get_header() must be called on every page because it loads the hidden <head></head> section in addition to the visible header. If you use a conditional statement to not include it on certain pages then those pages will break.

    If you want to hide the header completely then this CSS should do the trick:

    .site-header {
        display: none;
    }
    Thread Starter jashvina

    (@jashvina)

    Thank you – that worked!

    Is there any way to do it on a page-by-page basis? I still want it to show up on the home page

    Of course. WordPress adds a number of classes to the body tag so that you can do something like this.

    If you want to hide everywhere except on homepage this use this:

    .site-header {
        display: none;
    }
    
    .home .site-header {
        display: block;
    }

    If you wanted to hide it everywhere except for a page with id 595 you could use .page-id-595 instead of .home in the snippet above.

    Thread Starter jashvina

    (@jashvina)

    That worked perfectly!! Thank you so much ??

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Is there any way to remove a header from posts & pages?’ is closed to new replies.