SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    931
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to remove header for single blog post?

    Hi,

    I'm using twenty twelve theme and do not want the header image to appear in my single blog post. May I know how can I do that?

    My website is at nature-health.com and this is one of my blog post.

    Any help is appreciated.

  2. #2
    Non-Member nitsingh's Avatar
    Join Date
    Nov 2012
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You have to remove header code from single.php file which have code for single post. go in editor and open single.php and remove header code. It is very simple.

  3. #3
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    931
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by nitsingh View Post
    You have to remove header code from single.php file which have code for single post. go in editor and open single.php and remove header code. It is very simple.
    Hi, thank you. I follow what you say and remove the get_header(); but the website breaks without all the formatting... is this the code to remove in single.php?

  4. #4
    It's all Geek to me silver trophybronze trophy
    ralph.m's Avatar
    Join Date
    Mar 2009
    Location
    Melbourne, AU
    Posts
    24,176
    Mentioned
    454 Post(s)
    Tagged
    8 Thread(s)
    You may need to go to the header file itself and set a condition for when that part of the header does or does not appear.

    An easier, but not as good, option is simply to add this to your CSS:

    Code:
    .single .header-image {display: none;}

  5. #5
    Internet Business Optimizer KCgame's Avatar
    Join Date
    Mar 2005
    Location
    Singapore
    Posts
    931
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by ralph.m View Post
    You may need to go to the header file itself and set a condition for when that part of the header does or does not appear.

    An easier, but not as good, option is simply to add this to your CSS:

    Code:
    .single .header-image {display: none;}
    You save the day, Ralph! Thank you so much!

  6. #6
    Gre aus'm Pott gold trophysilver trophybronze trophy
    Pullo's Avatar
    Join Date
    Jun 2007
    Location
    Germany
    Posts
    5,938
    Mentioned
    214 Post(s)
    Tagged
    12 Thread(s)
    Hi there,

    As Ralph says, his solution works, but is not optimal, as the image is still downloaded (which is not so good for mobile users, for example).

    Alternatively, you could edit the file "header.php" in the Twenty Twelve theme and change this:

    PHP Code:
    <?php $header_image get_header_image();
      if ( ! empty( 
    $header_image ) ) : ?>
        <a href="<?php echo esc_urlhome_url'/' ) ); ?>"><img src="<?php echo esc_url$header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width?>" height="<?php echo get_custom_header()->height?>" alt="" /></a>
    <?php endif; ?>
    to this:

    PHP Code:
    <?php $header_image get_header_image();
      if ( ! empty( 
    $header_image ) && ! is_single()) : ?>
        <a href="<?php echo esc_urlhome_url'/' ) ); ?>"><img src="<?php echo esc_url$header_image ); ?>" class="header-image" width="<?php echo get_custom_header()->width?>" height="<?php echo get_custom_header()->height?>" alt="" /></a>
    <?php endif; ?>
    which will have the same effect.

    BTW: I didn't test this code, so if you try it out and it doesn't work, just let me know.

  7. #7
    Non-Member
    Join Date
    Jan 2013
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    To remove the header you can also do this via template file coding.
    There you can remove the code of header part only or you can change it with your customized header file like image or simple text lines.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •