Move all Feature Images => header image integration into a is_singular() check. Prevents a PHP notice when $post is not set (For example, a 404 page). Fixes #12661

git-svn-id: http://svn.automattic.com/wordpress/trunk@14002 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dd32 2010-04-05 02:58:39 +00:00
parent a87700319b
commit b22d2ea457

View File

@ -51,12 +51,11 @@
<div id="site-description"><?php bloginfo( 'description' ); ?></div>
<?php
// Retrieve the dimensions of the current post thumbnail -- no teensy header images for us!
$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail');
list($src, $width, $height) = $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 ) && $width >= HEADER_IMAGE_WIDTH ) :
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 : ?>