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.

This is my first wordpress website here and so far it'll looking good. The only thing I have left that I just can't figure out is the featured image for my blog page. I have set the main blog banner to a default featured image that's hard coded into the header.php file (and my blog page does not have a featured image so it usually shows the default like i should), which looks like this.

<?php

                // Check to see if we're on a non-home-page and if the non-home-page has a featured image.
                if( !is_front_page() && has_post_thumbnail() ) {

                    the_post_thumbnail( '960, 403' );

                // if we're on the home page 
                } elseif ( function_exists('dynamic_sidebar') && is_dynamic_sidebar('banner-widget') && is_front_page() ) {

                    dynamic_sidebar('banner-widget');

                // no featured image set
                } else {
                    echo '<img src="http://www.averylawoffice.ca/Avery-Banner-Default.jpg" alt="Avery Law Office | Summerland, BC">';
                }
                ?>

Which was working fine. Now I'm trying to set individual featured banners for each post but the minute I set one for the newest post the banner on the main blog page changes to that one. However all other later posts do what I want them to do. Is there something in the header I should change or have to set in single.php that I might be missing? If you need to see a specific code please let me know. I wasn't sure what page/code to show so I started with the header conditional tag. Any help or advice is appreciated as always!

share|improve this question

1 Answer 1

The code you have there should work based on the following assumptions

  1. You have set a thumbnail for each post
  2. You have enabled thumbnails
  3. You are calling that from within the loop

If you haven't done any one of those things you should be getting your default image. But that's just with a cursory glance at your code, and I could be wrong on that.

share|improve this answer
    
That I know I've done all that. However not 100% sure where else to look. I'll just have to deal with it. It's not that bad. –  kia4567 Jun 8 '12 at 17:49

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.