Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // The header image
- // Check if this is a post or page, if it has a thumbnail, and if it's a big one
- if( get_option( 'page_for_posts' ) ) $the_id = get_option( 'page_for_posts' );
- if( is_singular() ) $the_id = $post->ID;
- if ( (is_singular() || get_option( 'page_for_posts' )) &&
- has_post_thumbnail( $the_id ) &&
- ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $the_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( $the_id, 'post-thumbnail' );
- else : ?>
- <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
- <?php endif; // end check for featured image or standard header ?>
- </a>
- <?php endif; // end check for removed header image ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement