TwentyTen Header Image
-
Hi, can anyone explain how the below works? Why does the script detect a new header image when:
1. a singular page is displayed
2. with an attached image and
3. $image[1] >= HEADER_IMAGE_WIDTH (does this mean that the new image has a larger width than the width defined in the functions.php file?)Thanks in advance!
<?php // 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 ) && ( /* $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 : ?> <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" /> <?php endif; ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘TwentyTen Header Image’ is closed to new replies.