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/twentyeleven/header.php

    r20470 r20983  
    8080                $header_image = get_header_image();
    8181                if ( $header_image ) :
    82                     $header_image_width  = get_custom_header()->width;
    83             ?>
     82                    // Compatibility with versions of WordPress prior to 3.4.
     83                    if ( function_exists( 'get_custom_header' ) ) {
     84                        // We need to figure out what the minimum width should be for our featured image.
     85                        // This result would be the suggested width if the theme were to implement flexible widths.
     86                        $header_image_width = get_theme_support( 'custom-header', 'width' );
     87                    } else {
     88                        $header_image_width = HEADER_IMAGE_WIDTH;
     89                    }
     90                    ?>
    8491            <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
    8592                <?php
     
    9198                        // Houston, we have a new header image!
    9299                        echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    93                     else : ?>
    94                     <img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
     100                    else :
     101                        // Compatibility with versions of WordPress prior to 3.4.
     102                        if ( function_exists( 'get_custom_header' ) ) {
     103                            $header_image_width  = get_custom_header()->width;
     104                            $header_image_height = get_custom_header()->height;
     105                        } else {
     106                            $header_image_width  = HEADER_IMAGE_WIDTH;
     107                            $header_image_height = HEADER_IMAGE_HEIGHT;
     108                        }
     109                        ?>
     110                    <img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
    95111                <?php endif; // end check for featured image or standard header ?>
    96112            </a>
Note: See TracChangeset for help on using the changeset viewer.