I have a blog on wordpress.com in which I make use of the Twenty Ten theme. For each Post I can set a Featured image.

On Wordpress.com that image is then displayed in the header above the menu.

I'd like to gain the same for a Wordpress.org setup. How can I do this?

  • 1
    isn't that already implemented in TwentyTen? I remember seeing the featured image in the header area.. Commented Mar 25, 2011 at 23:50
  • I'm running a 3.0.5 site and it is not working that way. I think I need to debug further because I thought as well, that it should already work that way.
    – hakre
    Commented Mar 26, 2011 at 2:34

1 Answer 1


Not sure I understand your question completely hakre but here is the code that shows the featured image for twenty-ten in header.php.The image sizing is defined in the functions.php file.

It also uses a function called http://codex.wordpress.org/Function_Reference/get_header_image.

                    // 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() ) : ?>
                        <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
                    <?php endif; ?>
  • Thanks for the hint Wyck, it's probably related that I downloaded too small images and expected to get them blown up: $image[1] >= HEADER_IMAGE_WIDTH.
    – hakre
    Commented Mar 29, 2011 at 15:39
  • Yes it is [15 chars]
    – hakre
    Commented Mar 29, 2011 at 18:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.