Changeset 45581 for trunk/src/wp-content/themes/twentyten/header.php
- Timestamp:
- 07/01/2019 08:22:31 AM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyten/header.php
r45218 r45581 86 86 } 87 87 88 // Check if this is a post or page, if it has a thumbnail, and if it's a big one 89 if ( is_singular() && current_theme_supports( 'post-thumbnails' ) && 90 has_post_thumbnail( $post->ID ) && 91 ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) && 92 $image[1] >= $header_image_width ) : 93 // Houston, we have a new header image! 94 echo get_the_post_thumbnail( $post->ID ); 95 elseif ( get_header_image() ) : 96 // Compatibility with versions of WordPress prior to 3.4. 97 if ( function_exists( 'get_custom_header' ) ) { 98 $header_image_width = get_custom_header()->width; 99 $header_image_height = get_custom_header()->height; 100 } else { 101 $header_image_width = HEADER_IMAGE_WIDTH; 102 $header_image_height = HEADER_IMAGE_HEIGHT; 103 } 104 ?> 105 <img src="<?php header_image(); ?>" width="<?php echo esc_attr( $header_image_width ); ?>" height="<?php echo esc_attr( $header_image_height ); ?>" alt="" /> 106 <?php endif; ?> 88 // Check if this is a post or page, if it has a thumbnail, and if it's a big one 89 if ( is_singular() && has_post_thumbnail( $post->ID ) ) { 90 $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ); 91 if ( $image && $image[1] >= $header_image_width ) { 92 // Houston, we have a new header image! 93 echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); 94 } 95 } else { 96 // Compatibility with versions of WordPress prior to 3.4. 97 if ( function_exists( 'get_custom_header' ) ) { 98 $header_image_width = get_custom_header()->width; 99 $header_image_height = get_custom_header()->height; 100 } else { 101 $header_image_width = HEADER_IMAGE_WIDTH; 102 $header_image_height = HEADER_IMAGE_HEIGHT; 103 } 104 ?> 105 <img src="<?php header_image(); ?>" width="<?php echo esc_attr( $header_image_width ); ?>" height="<?php echo esc_attr( $header_image_height ); ?>" alt="" /> 106 <?php 107 } // end check for featured image or standard header 108 ?> 107 109 </div><!-- #branding --> 108 110
Note: See TracChangeset
for help on using the changeset viewer.