Changeset 20225 for trunk/wp-content/themes/twentyten/functions.php
- Timestamp:
- 03/20/2012 09:32:42 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 { }
Note: See TracChangeset
for help on using the changeset viewer.