WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#13671 closed defect (bug) (wontfix)

(TwentyTen) Featured image apparently not working

Reported by: arena Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0
Component: Themes Keywords:
Focuses: Cc:

Description

from last nightly build and RC1 or i missed something

Change History (6)

comment:1 follow-up: duck_4 years ago

  • Keywords reporter-feedback close added

Are you sure that you have selected an image with a great enough width? Twenty Ten makes sure the width of the image is greater than HEADER_IMAGE_WIDTH (940px).

comment:2 in reply to: ↑ 1 arena4 years ago

Replying to duck_:

Are you sure that you have selected an image with a great enough width? Twenty Ten makes sure the width of the image is greater than HEADER_IMAGE_WIDTH (940px).

will check that !
what is disturbing is that the image appears in the little box 'Featured image' when viewing the post.

comment:3 mikeschinkel4 years ago

  • Cc mikeschinkel@… added
  • Keywords reporter-feedback close removed
  • Resolution set to wontfix
  • Status changed from new to closed

@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.

comment:4 follow-up: arena4 years ago

I found what is wrong and post a new ticket

comment:5 in reply to: ↑ 4 arena4 years ago

Replying to arena:

I found what is wrong and post a new ticket

#13700

comment:6 nacin4 years ago

  • Milestone 3.0 deleted
Note: See TracTickets for help on using tickets.