Changeset 20225
- Timestamp:
- 03/20/2012 09:32:42 PM (13 years ago)
- Location:
- trunk/wp-content/themes
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentyeleven/functions.php
r20222 r20225 63 63 * @uses load_theme_textdomain() For translation/localization support. 64 64 * @uses add_editor_style() To style the visual editor. 65 * @uses add_theme_support() To add support for post thumbnails, automatic feed links, and Post Formats. 65 * @uses add_theme_support() To add support for post thumbnails, automatic feed links, custom headers 66 * and backgrounds, and post formats. 66 67 * @uses register_nav_menus() To add support for navigation menus. 67 * @uses add_custom_background() To add support for a custom background.68 * @uses add_custom_image_header() To add support for a custom header.69 68 * @uses register_default_headers() To register the default custom header images provided with the theme. 70 69 * @uses set_post_thumbnail_size() To set a custom post thumbnail size. … … 235 234 * Styles the header image displayed on the Appearance > Header admin panel. 236 235 * 237 * Referenced via add_ custom_image_header() in twentyeleven_setup().236 * Referenced via add_theme_support('custom-header') in twentyeleven_setup(). 238 237 * 239 238 * @since Twenty Eleven 1.0 … … 285 284 * Custom header image markup displayed on the Appearance > Header admin panel. 286 285 * 287 * Referenced via add_ custom_image_header() in twentyeleven_setup().286 * Referenced via add_theme_support('custom-header') in twentyeleven_setup(). 288 287 * 289 288 * @since Twenty Eleven 1.0 -
trunk/wp-content/themes/twentyeleven/showcase.php
r19379 r20225 67 67 $counter_slider = 0; 68 68 69 $header_image_width = get_theme_support( 'custom-header', 'width' ); 70 $header_image_height = get_theme_support( 'custom-header', 'height' ); 69 71 ?> 70 72 … … 90 92 91 93 // Hang on. Let's check this here image out. 92 $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH) );94 $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ); 93 95 94 96 // Is it bigger than or equal to our header? 95 if ( $image[1] >= HEADER_IMAGE_WIDTH) {97 if ( $image[1] >= $header_image_width ) { 96 98 // If bigger, let's add a BIGGER class. It's EXTRA classy now. 97 99 $feature_class = 'feature-image large'; … … 108 110 */ 109 111 if ( has_post_thumbnail() ) { 110 if ( $image[1] >= HEADER_IMAGE_WIDTH)112 if ( $image[1] >= $header_image_width ) 111 113 $thumbnail_size = 'large-feature'; 112 114 else -
trunk/wp-content/themes/twentyten/functions.php
r19582 r20225 62 62 * functions.php file. 63 63 * 64 * @uses add_theme_support() To add support for post thumbnails and automatic feed links.64 * @uses add_theme_support() To add support for post thumbnails, custom headers and backgrounds, and automatic feed links. 65 65 * @uses register_nav_menus() To add support for navigation menus. 66 * @uses add_custom_background() To add support for a custom background.67 66 * @uses add_editor_style() To style the visual editor. 68 67 * @uses load_theme_textdomain() For translation/localization support. 69 * @uses add_custom_image_header() To add support for a custom header.70 68 * @uses register_default_headers() To register the default custom header images provided with the theme. 71 69 * @uses set_post_thumbnail_size() To set a custom post thumbnail size. … … 101 99 ) ); 102 100 103 // This theme allows users to set a custom background 104 add_custom_background(); 105 106 // Your changeable header business starts here 107 if ( ! defined( 'HEADER_TEXTCOLOR' ) ) 108 define( 'HEADER_TEXTCOLOR', '' ); 109 110 // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI. 111 if ( ! defined( 'HEADER_IMAGE' ) ) 112 define( 'HEADER_IMAGE', '%s/images/headers/path.jpg' ); 113 114 // The height and width of your custom header. You can hook into the theme's own filters to change these values. 115 // Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values. 116 define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 940 ) ); 117 define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 198 ) ); 101 // This theme allows users to set a custom background. 102 add_theme_support( 'custom-background' ); 103 104 // The custom header business starts here. 105 106 add_theme_support( 'custom-header', array( 107 // The default image to use. 108 // The %s is a placeholder for the theme template directory URI. 109 'default-image' => '%s/images/headers/path.jpg', 110 // The height and width of our custom header. 111 'width' => apply_filters( 'twentyten_header_image_width', 940 ), 112 'height' => apply_filters( 'twentyten_header_image_height', 198 ), 113 // Don't support text inside the header image. 114 'header-text' => false, 115 // Callback for styling the header preview in the admin. 116 'admin-header-callback' => 'twentyten_admin_header_style', 117 ) ); 118 118 119 119 // We'll be using post thumbnails for custom header images on posts and pages. 120 120 // We want them to be 940 pixels wide by 198 pixels tall. 121 121 // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. 122 set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true ); 123 124 // Don't support text inside the header image. 125 if ( ! defined( 'NO_HEADER_TEXT' ) ) 126 define( 'NO_HEADER_TEXT', true ); 127 128 // Add a way for the custom header to be styled in the admin panel that controls 129 // custom headers. See twentyten_admin_header_style(), below. 130 add_custom_image_header( '', 'twentyten_admin_header_style' ); 131 132 // ... and thus ends the changeable header business. 122 set_post_thumbnail_size( get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ), true ); 123 124 // ... and thus ends the custom header business. 133 125 134 126 // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. … … 202 194 border-top: 4px solid #000; 203 195 } 204 /* If NO_HEADER_TEXT is false, you would style the text with these selectors:196 /* If header-text was supported, you would style the text with these selectors: 205 197 #headimg #name { } 206 198 #headimg #desc { } -
trunk/wp-content/themes/twentyten/header.php
r19599 r20225 71 71 has_post_thumbnail( $post->ID ) && 72 72 ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) && 73 $image[1] >= HEADER_IMAGE_WIDTH) :73 $image[1] >= get_theme_support( 'custom-header', 'width' ) ) : 74 74 // Houston, we have a new header image! 75 75 echo get_the_post_thumbnail( $post->ID ); 76 76 elseif ( get_header_image() ) : ?> 77 <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />77 <img src="<?php header_image(); ?>" width="<?php echo get_theme_support( 'custom-header', 'width' ); ?>" height="<?php echo get_theme_support( 'custom-header', 'height' ); ?>" alt="" /> 78 78 <?php endif; ?> 79 79 </div><!-- #branding -->
Note: See TracChangeset
for help on using the changeset viewer.