WordPress.org

Make WordPress Core

Changeset 20470


Ignore:
Timestamp:
04/15/2012 07:53:10 PM (6 years ago)
Author:
nacin
Message:

Flexible heights for Twenty Eleven's custom headers. see #20448.

Location:
trunk/wp-content/themes/twentyeleven
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyeleven/functions.php

    r20231 r20470  
    116116        'width' => apply_filters( 'twentyeleven_header_image_width', 1000 ),
    117117        'height' => apply_filters( 'twentyeleven_header_image_height', 288 ),
     118        // Support flexible heights.
     119        'flex-height' => true,
    118120        // Random image rotation by default.
    119121        'random-default' => true,
  • trunk/wp-content/themes/twentyeleven/header.php

    r20465 r20470  
    8080                $header_image = get_header_image();
    8181                if ( $header_image ) :
    82                     $header_image_width  = get_theme_support( 'custom-header', 'width' );
    83                     $header_image_height = get_theme_support( 'custom-header', 'height' );
     82                    $header_image_width  = get_custom_header()->width;
    8483            ?>
    8584            <a href="<?php echo esc_url( home_url( '/' ) ); ?>">
     
    8786                    // The header image
    8887                    // Check if this is a post or page, if it has a thumbnail, and if it's a big one
    89                     if ( is_singular() &&
    90                             has_post_thumbnail( $post->ID ) &&
     88                    if ( is_singular() && has_post_thumbnail( $post->ID ) &&
    9189                            ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
    9290                            $image[1] >= $header_image_width ) :
     
    9492                        echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    9593                    else : ?>
    96                     <img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
     94                    <img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo get_custom_header()->height; ?>" alt="" />
    9795                <?php endif; // end check for featured image or standard header ?>
    9896            </a>
Note: See TracChangeset for help on using the changeset viewer.