How to Stop a Post's Featured Image Appearing in Site Header

The TwentyTen theme has an annoying feature which causes the image in your site header to be replaced by a post's Featured Image. I have no idea what they were thinking, other than that the featured image wasn't used anywhere else in the theme, so perhaps they should use it to override the image in the header.

Well that's a bad idea. Even though the theme doesn't use it, sites like Facebook will use the featured image as the thumbnail when a post is shared. It just doesn't make sense to change your site header according to the featured image.

In order to fix this, you have to edit your theme's header.php, preferably by creating a child theme. Search for these lines:

// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
        has_post_thumbnail( $post->ID ) &&
        ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
        $image[1] >= $header_image_width ) :
    // Houston, we have a new header image!
    echo get_the_post_thumbnail( $post->ID );
elseif ( get_header_image() ) :

And change them to:

// Always use the header image; dont put the featured image in the header!
if ( get_header_image() ) :

If you use MailPress, note that it attempts to follow suit; and even worse, in doing so it triggers a bug that prevents posts with a featured image from being sent at all. See this article on how to modify it too.

Liked this post? Subscribe to get more like it via email.

About Graham

I'm the creator of BuildYourBlog.net.
This entry was posted in Themes and tagged , . Bookmark the permalink.

2 Responses to How to Stop a Post's Featured Image Appearing in Site Header

  1. Putu says:

    Very helpful guide ineded, thank you.It did take me a while to figure out that I also needed to enable the Connection_PHP_mail add on, under plugins, before my test mails would send –a0before that, they failed.I'd like to follow your cron instructions, but made the probably bad choice of Ipage.com as a host, and they have a proprietary control panel (not cpanel) and no way of setting up cron jobs. (Note to self: always choose host with cpanel in future.)I have a further question – how can one set the day/time when a weekly or monthly email goes out? I am about to start work on another blog/mail project where it's important that a weekly bulk mail goes out on a Monday evening –a0but I can't see any setting for this in Mailpress. David recently posted..South Africa’s electricity regulator approves two more CSP applications

  2. Amanda Waters says:

    Finally! I was having this issue on my blog (Baby Names) for 2 days and couln't find a solution. It was so easy! Many thanks and all the best in 2014 🙂

Comments are closed.