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