Make WordPress Core


Ignore:
File:
1 edited

Legend:

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

    r17300 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] >= HEADER_IMAGE_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() ) : ?>
    77                                                 <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
     85                                        elseif ( get_header_image() ) :
     86                                                // Compatibility with versions of WordPress prior to 3.4.
     87                                                if ( function_exists( 'get_custom_header' ) ) {
     88                                                        $header_image_width  = get_custom_header()->width;
     89                                                        $header_image_height = get_custom_header()->height;
     90                                                } else {
     91                                                        $header_image_width  = HEADER_IMAGE_WIDTH;
     92                                                        $header_image_height = HEADER_IMAGE_HEIGHT;
     93                                                }
     94                                        ?>
     95                                                <img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
    7896                                        <?php endif; ?>
    7997                        </div><!-- #branding -->
    8098
    8199                        <div id="access" role="navigation">
    82                           <?php /*  Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
     100                          <?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
    83101                                <div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>"><?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
    84                                 <?php /* Our navigation menu.  If one isn't filled out, wp_nav_menu falls back to wp_page_menu.  The menu assiged to the primary position is the one used.  If none is assigned, the menu with the lowest ID is used. */ ?>
     102                                <?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
    85103                                <?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
    86104                        </div><!-- #access -->
Note: See TracChangeset for help on using the changeset viewer.