Skip to content

Commit

Permalink
Flexible heights for Twenty Ten's custom headers. see #20448.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.automattic.com/wordpress/trunk@20474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
  • Loading branch information
nacin committed Apr 15, 2012
1 parent 0393394 commit fa63170
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions wp-content/themes/twentyten/functions.php
Expand Up @@ -105,6 +105,8 @@ function twentyten_setup() {
// The height and width of our custom header. // The height and width of our custom header.
'width' => apply_filters( 'twentyten_header_image_width', 940 ), 'width' => apply_filters( 'twentyten_header_image_width', 940 ),
'height' => apply_filters( 'twentyten_header_image_height', 198 ), 'height' => apply_filters( 'twentyten_header_image_height', 198 ),
// Support flexible heights.
'flex-height' => true,
// Don't support text inside the header image. // Don't support text inside the header image.
'header-text' => false, 'header-text' => false,
// Callback for styling the header preview in the admin. // Callback for styling the header preview in the admin.
Expand Down
11 changes: 9 additions & 2 deletions wp-content/themes/twentyten/header.php
Expand Up @@ -73,8 +73,15 @@
$image[1] >= get_theme_support( 'custom-header', 'width' ) ) : $image[1] >= get_theme_support( 'custom-header', 'width' ) ) :
// Houston, we have a new header image! // Houston, we have a new header image!
echo get_the_post_thumbnail( $post->ID ); echo get_the_post_thumbnail( $post->ID );
elseif ( get_header_image() ) : ?> elseif ( get_header_image() ) :
<img src="<?php header_image(); ?>" width="<?php echo get_theme_support( 'custom-header', 'width' ); ?>" height="<?php echo get_theme_support( 'custom-header', 'height' ); ?>" alt="" /> if ( function_exists( 'get_custom_header' ) ) {
$header_width = get_custom_header()->width;
$header_height = get_custom_header()->height;
} else {
$header_height = $header_width = '';
}
?>
<img src="<?php header_image(); ?>" width="<?php echo $header_width; ?>" height="<?php echo $header_height; ?>" alt="" />
<?php endif; ?> <?php endif; ?>
</div><!-- #branding --> </div><!-- #branding -->


Expand Down

0 comments on commit fa63170

Please sign in to comment.