X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/bf5c68485ef07868ad0a91168ecd0092af7661ae..8f374b7233bc2815ccc387e448d208c5434eb961:/wp-content/themes/twentyeleven/header.php diff --git a/wp-content/themes/twentyeleven/header.php b/wp-content/themes/twentyeleven/header.php index b1be094a..59b6d3b1 100644 --- a/wp-content/themes/twentyeleven/header.php +++ b/wp-content/themes/twentyeleven/header.php @@ -78,20 +78,36 @@ + if ( $header_image ) : + // Compatibility with versions of WordPress prior to 3.4. + if ( function_exists( 'get_custom_header' ) ) { + // We need to figure out what the minimum width should be for our featured image. + // This result would be the suggested width if the theme were to implement flexible widths. + $header_image_width = get_theme_support( 'custom-header', 'width' ); + } else { + $header_image_width = HEADER_IMAGE_WIDTH; + } + ?> ID ) && - ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH ) ) ) && - $image[1] >= 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 ), array( $header_image_width, $header_image_width ) ) ) && + $image[1] >= $header_image_width ) : // Houston, we have a new header image! echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); - else : ?> - + else : + // Compatibility with versions of WordPress prior to 3.4. + if ( function_exists( 'get_custom_header' ) ) { + $header_image_width = get_custom_header()->width; + $header_image_height = get_custom_header()->height; + } else { + $header_image_width = HEADER_IMAGE_WIDTH; + $header_image_height = HEADER_IMAGE_HEIGHT; + } + ?> + @@ -100,7 +116,7 @@ // Has the text been hidden? if ( 'blank' == get_header_textcolor() ) : ?> -
+

- + - + 'primary' ) ); ?> -
\ No newline at end of file +