WordPress.org

Make WordPress Core

Changeset 13836


Ignore:
Timestamp:
03/27/10 01:59:46 (4 years ago)
Author:
iammattthomas
Message:

Twenty Ten: Don't use post thumbnail as the custom header if it's smaller than the header size. See #12661. Props iandstewart

File:
1 edited

Legend:

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

    r13830 r13836  
    3535 
    3636                <?php 
    37                 if ( is_singular() && has_post_thumbnail( $post->ID ) ) : 
    38                     echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); 
    39                 else : ?> 
    40                     <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" /> 
    41                 <?php endif; ?> 
     37                    // Retrieve the dimensions of the current post thumbnail -- no teensy header images for us! 
     38                    $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail'); 
     39                    list($src, $width, $height) = $image; 
     40                     
     41                    // Check if this is a post or page, if it has a thumbnail, and if it's a big one 
     42                    if ( is_singular() && has_post_thumbnail( $post->ID ) && $width >= HEADER_IMAGE_WIDTH ) :        
     43                        // Houston, we have a new header image! 
     44                        echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' ); 
     45                    else : ?> 
     46                        <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" /> 
     47                    <?php endif; ?> 
    4248            </div><!-- #branding --> 
    4349 
Note: See TracChangeset for help on using the changeset viewer.