[wp-trac] [WordPress Trac] #13671: (TwentyTen) Featured image apparently not working

WordPress Trac wp-trac at lists.automattic.com
Wed Jun 2 07:29:53 UTC 2010


#13671: (TwentyTen) Featured image apparently not working
--------------------------+-------------------------------------------------
 Reporter:  arena         |        Owner:         
     Type:  defect (bug)  |       Status:  closed 
 Priority:  normal        |    Milestone:  3.0    
Component:  Themes        |      Version:  3.0    
 Severity:  normal        |   Resolution:  wontfix
 Keywords:                |  
--------------------------+-------------------------------------------------
Changes (by mikeschinkel):

 * cc: mikeschinkel@… (added)
  * keywords:  reporter-feedback close =>
  * status:  new => closed
  * resolution:  => wontfix


Comment:

 @arena: My guess is you have tripped over the following problem:  #12661

 As you can see the decision was made for the featured image to display in
 the header instead of floating right or left in the post but if it is not
 the correct width to be a header image then nothing will display at all.

 Personally I think that decision will be regretted as it will likely cause
 no end of consternation and wasted time for users who cannot figure out
 why it's not working at they expect, similar to your situation.
 Ironically as it did for me when I gave a presentation to the local
 WordPress meetup group on new features of v3.0 a few weeks ago. Ironic
 because I posted #12661 but forgot about it's outcome as I was
 embarrassingly trying to demonstrate to the audience a great new feature
 that I the presenter could not get to work!

 Fortunately ptahdunbar was in the audience and he pointed out what I had
 forgotten thus saving that part of the presentation from complete failure.
 At that point I showed them how to modify their single.php theme template
 file so that the featured image would appear floating right (or left) at
 the top of the post exactly as evidently everyone in the audience
 (including myself) expected.

 '''Your solution?'''  Remove this code from `header.php`:

        if ( is_singular() &&
                 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, 'post-thumbnail' );
     else : ?>
         <img src="<?php header_image(); ?>" width="<?php echo
 HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt=""
 />
     <?php endif; ?>

 Replacing it with just:

     <img src="<?php header_image(); ?>" width="<?php echo
 HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt=""
 />

 And then add this snippet in your `single.php`, `page.php` and other
 templates:

    <?php echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); ?>

 ''Everyone else's solution?'' Hopefully they will be lucky enough to find
 a page like this that explains the problem and not waste too much time or
 become too frustrated, nor develop a poor opinion of WordPress in the
 process.  :-(

 I'm going to close this because this issue was already addressed in #12661
 and the resolution was just not to display it if it wasn't the correct
 size to be a header.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/13671#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list