Make WordPress Core


Ignore:
Timestamp:
06/04/2012 02:43:19 PM (12 years ago)
Author:
ryan
Message:

Back compat for bundled themes. Props nacin, SergeyBiryukov, kobenland. fixes #20768

File:
1 edited

Legend:

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

    r20474 r20983  
    6767
    6868                <?php
     69                    // Compatibility with versions of WordPress prior to 3.4.
     70                    if ( function_exists( 'get_custom_header' ) ) {
     71                        // We need to figure out what the minimum width should be for our featured image.
     72                        // This result would be the suggested width if the theme were to implement flexible widths.
     73                        $header_image_width = get_theme_support( 'custom-header', 'width' );
     74                    } else {
     75                        $header_image_width = HEADER_IMAGE_WIDTH;
     76                    }
     77
    6978                    // Check if this is a post or page, if it has a thumbnail, and if it's a big one
    7079                    if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
    7180                            has_post_thumbnail( $post->ID ) &&
    7281                            ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
    73                             $image[1] >= get_theme_support( 'custom-header', 'width' ) ) :
     82                            $image[1] >= $header_image_width ) :
    7483                        // Houston, we have a new header image!
    7584                        echo get_the_post_thumbnail( $post->ID );
    76                     elseif ( get_header_image() ) :
     85                    elseif ( get_header_image() ) :
     86                        // Compatibility with versions of WordPress prior to 3.4.
    7787                        if ( function_exists( 'get_custom_header' ) ) {
    78                             $header_width  = get_custom_header()->width;
    79                             $header_height = get_custom_header()->height;
     88                            $header_image_width  = get_custom_header()->width;
     89                            $header_image_height = get_custom_header()->height;
    8090                        } else {
    81                             $header_height = $header_width = '';
     91                            $header_image_width  = HEADER_IMAGE_WIDTH;
     92                            $header_image_height = HEADER_IMAGE_HEIGHT;
    8293                        }
    83                         ?>
    84                         <img src="<?php header_image(); ?>" width="<?php echo $header_width; ?>" height="<?php echo $header_height; ?>" alt="" />
     94                    ?>
     95                        <img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
    8596                    <?php endif; ?>
    8697            </div><!-- #branding -->
Note: See TracChangeset for help on using the changeset viewer.