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'm new to Wordpress, so sorry if I've missed something obvious.

I have a site using (a local child of) the twentyeleven theme. I've found that if I set Featured Images on pages and posts, then that image replaces the header image; which is great.

However, if I customise the theme to display a Static Front Page, designate another page (recent-news, say) as my Posts page, and set a Featured Image on recent-news, then recent-news doesn't show that as the custom header image - instead it shows the twentyeleven random images. How can I fix this?

Also, I don't know if it's related, but any content I have on the recent-news page isn't shown; its only displayed content is the summaries of the Posts.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

if you work with a static front page, the ID for the posts page is get_option('page_for_posts').

try and replace this section:

            <?php
            /*
             * The 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() && has_post_thumbnail( $post->ID ) &&
                    ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
                    $image[1] >= $header_image_width ) :
                // Houston, we have a new header image!
                echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );

with something like:

            <?php //edited to show the selected featured image if a static page is selected as posts page
            // The 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() ) $post_id = $post->ID;
            elseif ( is_home() && get_option('page_for_posts') ) $post_id = get_option('page_for_posts');
            if ( ( is_singular() || is_home() && get_option('page_for_posts') ) &&
                    has_post_thumbnail( $post_id ) &&
                    ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), array( $header_image_width, $header_image_width ) ) ) &&
                    $image[1] >= $header_image_width ) :
                // Houston, we have a new header image!
                echo get_the_post_thumbnail( $post_id, 'post-thumbnail' );

(not tested in wp3.7.1)

but any content I have on the recent-news page isn't shown; its only displayed content is the summaries of the Posts

that is the way the posts page works when set together with a static front page, as it is using the index template - http://codex.wordpress.org/Creating_a_Static_Front_Page

share|improve this answer
    
Ok, thanks, I'll give that a whirl. What file would that be in (I'm working with a host where searching the files isn't especially straightforward)? –  Chowlett Nov 16 '13 at 13:23
    
nm, found it. Works a treat, thank you! –  Chowlett Nov 16 '13 at 14:56

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.