[wp-trac] [WordPress Trac] #12661: In TwentyTen Theme, use of Post Thumbnail in Content Area instead of as Header Replacement
WordPress Trac
wp-trac at lists.automattic.com
Mon Apr 5 02:23:41 UTC 2010
#12661: In TwentyTen Theme, use of Post Thumbnail in Content Area instead of as
Header Replacement
--------------------------+-------------------------------------------------
Reporter: mikeschinkel | Owner: iammattthomas
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 3.0
Component: Themes | Version: 3.0
Severity: normal | Resolution:
Keywords: |
--------------------------+-------------------------------------------------
Comment(by nacin):
Looks like this causes some issues on a page that isn't singular, as we're
unconditionally checking for $post->ID, which wouldn't always be a post
object (like on a 404).
Additionally, is_singular() includes attachments. We may want that to only
be is_singular() && !is_attachment() (or I guess that would be is_single()
|| is_page()).
Untested, but something like this should do the trick:
{{{
<?php
// Retrieve the dimensions of the current post thumbnail -- no teensy
header images for us!
// 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() && $image =
wp_get_attachment_image_src( get_post_thumbnail_id() ) && $image['width']
>= HEADER_IMAGE_WIDTH ) :
the_post_thumbnail();
else : ?>
<img src="<?php header_image(); ?>"
width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo
HEADER_IMAGE_HEIGHT; ?>" alt="" />
<?php endif; ?>
}}}
--
Ticket URL: <http://core.trac.wordpress.org/ticket/12661#comment:6>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list