Changeset 20983 for trunk/wp-content/themes/twentyeleven/functions.php
- Timestamp:
- 06/04/2012 02:43:19 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentyeleven/functions.php
r20973 r20983 115 115 116 116 // Add support for custom headers. 117 add_theme_support( 'custom-header',array(117 $custom_header_support = array( 118 118 // The default header text color. 119 119 'default-text-color' => '000', … … 131 131 // Callback used to display the header preview in the admin. 132 132 'admin-preview-callback' => 'twentyeleven_admin_header_image', 133 ) ); 133 ); 134 135 add_theme_support( 'custom-header', $custom_header_support ); 136 137 if ( ! function_exists( 'get_custom_header' ) ) { 138 // This is all for compatibility with versions of WordPress prior to 3.4. 139 define( 'HEADER_TEXTCOLOR', $custom_header_support['default-text-color'] ); 140 define( 'HEADER_IMAGE', '' ); 141 define( 'HEADER_IMAGE_WIDTH', $custom_header_support['width'] ); 142 define( 'HEADER_IMAGE_HEIGHT', $custom_header_support['height'] ); 143 add_custom_image_header( $custom_header_support['wp-head-callback'], $custom_header_support['admin-head-callback'], $custom_header_support['admin-preview-callback'] ); 144 add_custom_background(); 145 } 134 146 135 147 // We'll be using post thumbnails for custom header images on posts and pages. 136 148 // We want them to be the size of the header image that we just defined 137 149 // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. 138 set_post_thumbnail_size( get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ), true );150 set_post_thumbnail_size( $custom_header_support['width'], $custom_header_support['height'], true ); 139 151 140 152 // Add Twenty Eleven's custom image sizes. 141 153 // Used for large feature (header) images. 142 add_image_size( 'large-feature', get_theme_support( 'custom-header', 'width' ), get_theme_support( 'custom-header', 'height' ), true );154 add_image_size( 'large-feature', $custom_header_support['width'], $custom_header_support['height'], true ); 143 155 // Used for featured posts if a large-feature doesn't exist. 144 156 add_image_size( 'small-feature', 500, 300 ); … … 208 220 209 221 // If no custom options for text are set, let's bail. 210 if ( $text_color == get_theme_support( 'custom-header', 'default-text-color' ))222 if ( $text_color == HEADER_TEXTCOLOR ) 211 223 return; 224 212 225 // If we get this far, we have custom styles. Let's do this. 213 226 ?> … … 270 283 <?php 271 284 // If the user has set a custom color for the text use that 272 if ( get_header_textcolor() != get_theme_support( 'custom-header', 'default-text-color' )) :285 if ( get_header_textcolor() != HEADER_TEXTCOLOR ) : 273 286 ?> 274 287 #site-title a,
Note: See TracChangeset
for help on using the changeset viewer.