Changeset 21328
- Timestamp:
- 07/25/2012 05:12:40 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentytwelve/inc/custom-header.php
r21262 r21328 10 10 11 11 /** 12 * Back compat support for get_custom_header(). 13 * New since WordPress version 3.4. 14 * 15 * To provide backward compatibility with previous versions, we 16 * will define our own version of this function. 17 * 18 * @todo Should this go into core instead? 19 * 20 * @return stdClass All properties represent attributes of the current header image. 21 * 22 * @package Twenty_Twelve 23 * @since Twenty Twelve 1.0 24 */ 25 if ( ! function_exists( 'get_custom_header' ) ) { 26 function get_custom_header() { 27 return (object) array( 28 'url' => get_header_image(), 29 'thumbnail_url' => get_header_image(), 30 'width' => HEADER_IMAGE_WIDTH, 31 'height' => HEADER_IMAGE_HEIGHT 32 ); 33 } 34 } 35 36 /** 37 * Setup the WordPress core custom header arguments and settings. 12 * Set up the WordPress core custom header arguments and settings. 38 13 * 39 14 * Use add_theme_support() to register support for WordPress 3.4+ 40 * as well as provide backward compatibility for previous versions.41 *42 * Use feature detection of wp_get_theme() which was introduced43 * in WordPress 3.4.44 15 * 45 16 * @uses twentytwelve_header_style() … … 73 44 ); 74 45 75 // Allow child themes to filter any of these arguments. 76 $args = apply_filters( 'twentytwelve_custom_header_args', $args ); 77 78 if ( function_exists( 'wp_get_theme' ) ) { 79 add_theme_support( 'custom-header', $args ); 80 } else { 81 // Back compat for < 3.4 versions. 82 define( 'HEADER_TEXTCOLOR', $args['default-text-color'] ); 83 define( 'HEADER_IMAGE', $args['default-image'] ); 84 define( 'HEADER_IMAGE_WIDTH', $args['width'] ); 85 define( 'HEADER_IMAGE_HEIGHT', $args['height'] ); 86 add_custom_image_header( $args['wp-head-callback'], $args['admin-head-callback'], $args['admin-preview-callback'] ); 87 } 46 // Add support and allow child themes to filter any of these arguments. 47 add_theme_support( 'custom-header', apply_filters( 'twentytwelve_custom_header_args', $args ) ); 88 48 } 89 49 add_action( 'after_setup_theme', 'twentytwelve_custom_header_setup' );
Note: See TracChangeset
for help on using the changeset viewer.