From 0ff408d5636804f32cc2cf17a281769e195b2026 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 16 Feb 2021 19:25:26 +0000 Subject: [PATCH] Twenty Ten: Correct the fallback to the default header if the featured image width is narrower than the `twentyten_header_image_width` setting. Follow-up to [45581]. Props sabernhardt, macmanx, audrasjb. Fixes #52516. git-svn-id: https://develop.svn.wordpress.org/trunk@50361 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-content/themes/twentyten/header.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/wp-content/themes/twentyten/header.php b/src/wp-content/themes/twentyten/header.php index 17dd16c7a5..a15e5b52fc 100644 --- a/src/wp-content/themes/twentyten/header.php +++ b/src/wp-content/themes/twentyten/header.php @@ -87,12 +87,13 @@ if ( is_singular() && get_option( 'thread_comments' ) ) { } // Check if this is a post or page, if it has a thumbnail, and if it's a big one. + $image = false; if ( is_singular() && has_post_thumbnail( $post->ID ) ) { $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ); - if ( $image && $image[1] >= $header_image_width ) { - // Houston, we have a new header image! - echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); - } + } + if ( $image && $image[1] >= $header_image_width ) { + // Houston, we have a new header image! + echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); } else { // Compatibility with versions of WordPress prior to 3.4. if ( function_exists( 'get_custom_header' ) ) {