Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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?

share|improve this question
1  
isn't that already implemented in TwentyTen? I remember seeing the featured image in the header area.. –  onetrickpony Mar 25 '11 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 Mar 26 '11 at 2:34
add comment

1 Answer

up vote 2 down vote accepted

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.

<?php
                    // 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; ?>
share|improve this answer
    
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 Mar 29 '11 at 15:39
    
Yes it is [15 chars] –  hakre Mar 29 '11 at 18:55
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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