Advertisement
alchymyth

header posts page 2011 child

Jul 25th, 2012
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.92 KB | None | 0 0
  1. @@hreplace this section in header.php:
  2.             <?php
  3.                 // Check to see if the header image has been removed
  4.                 $header_image = get_header_image();
  5.                 if ( $header_image ) :
  6.                     // Compatibility with versions of WordPress prior to 3.4.
  7.                     if ( function_exists( 'get_custom_header' ) ) {
  8.                         // We need to figure out what the minimum width should be for our featured image.
  9.                         // This result would be the suggested width if the theme were to implement flexible widths.
  10.                         $header_image_width = get_theme_support( 'custom-header', 'width' );
  11.                     } else {
  12.                         $header_image_width = HEADER_IMAGE_WIDTH;
  13.                     }
  14.                     ?>
  15.             <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
  16.                 <?php
  17.                     // The header image
  18.                     // Check if this is a post or page, if it has a thumbnail, and if it's a big one
  19.                     if ( is_singular() && has_post_thumbnail( $post->ID ) &&
  20.                             ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
  21.                             $image[1] >= $header_image_width ) :
  22.                         // Houston, we have a new header image!
  23.                         echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
  24.                     else :
  25.  
  26.  
  27. @@hwith:
  28.                 <?php
  29.                     // The header image
  30.                     // Check if this is a post or page, if it has a thumbnail, and if it's a big one
  31.                     if( is_singular() ) $post_id = $post->ID;
  32.                     elseif ( is_home() && get_option('page_for_posts') ) $post_id = get_option('page_for_posts');
  33.                     if ( ( is_singular() || is_home() && get_option('page_for_posts') ) &&
  34.                             has_post_thumbnail( $post_id ) &&
  35.                             ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post_id ), array( $header_image_width, $header_image_width ) ) ) &&
  36.                             $image[1] >= $header_image_width ) :
  37.                         // Houston, we have a new header image!
  38.                         echo get_the_post_thumbnail( $post_id, 'post-thumbnail' );
  39.                     else :
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement