WordPress.org

Make WordPress Core

Changeset 14002


Ignore:
Timestamp:
04/05/10 02:58:39 (4 years ago)
Author:
dd32
Message:

Move all Feature Images => header image integration into a is_singular() check. Prevents a PHP notice when $post is not set (For example, a 404 page). Fixes #12661

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/header.php

    r13885 r14002  
    4545                <?php if ( is_home() || is_front_page() ) { ?> 
    4646                    <h1 id="site-title"><span><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></h1> 
    47                 <?php } else { ?>    
     47                <?php } else { ?> 
    4848                    <div id="site-title"><span><a href="<?php echo home_url( '/' ); ?>" title="<?php echo esc_attr( get_bloginfo( 'name', 'display' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></span></div> 
    4949                <?php } ?> 
     
    5252 
    5353                <?php 
    54                     // Retrieve the dimensions of the current post thumbnail -- no teensy header images for us! 
    55                     $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail'); 
    56                     list($src, $width, $height) = $image; 
    57                      
    5854                    // Check if this is a post or page, if it has a thumbnail, and if it's a big one 
    59                     if ( is_singular() && has_post_thumbnail( $post->ID ) && $width >= HEADER_IMAGE_WIDTH ) :        
     55                    if (    is_singular() && 
     56                            has_post_thumbnail( $post->ID ) && 
     57                            ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail') ) && 
     58                            $image[1] >= HEADER_IMAGE_WIDTH ) : 
    6059                        // Houston, we have a new header image! 
    6160                        echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); 
Note: See TracChangeset for help on using the changeset viewer.