Advertisement
alchymyth

creativix header image fix

Apr 4th, 2012
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.05 KB | None | 0 0
  1.     <div id="header">
  2.  
  3. <?php
  4.                 // Check to see if the header image has been removed
  5.                 $header_image = get_header_image();
  6.                 if ( ! empty( $header_image ) ) :
  7.             ?>
  8.             <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
  9.                 <?php
  10.                     // The header image
  11.                     // Check if this is a post or page, if it has a thumbnail, and if it's a big one
  12.                     if ( is_singular() &&
  13.                             has_post_thumbnail( $post->ID ) &&
  14.                             ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH ) ) ) &&
  15.                             $image[1] >= HEADER_IMAGE_WIDTH ) :
  16.                         // Houston, we have a new header image!
  17.                         echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
  18.                     else : ?>
  19.                     <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
  20.                 <?php endif; // end check for featured image or standard header ?>
  21.             </a>
  22.             <?php endif; // end check for removed header image ?>
  23.  
  24.            
  25.         <div id="logoname">
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement