Advertisement
alchymyth

header image section twenty eleven 1.3

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