Twenty Twelve: remove back compat for custom header image, installs prior to 3.4 will not see it as an option. Props obenland, closes #21231.

git-svn-id: http://core.svn.wordpress.org/trunk@21328 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
lancewillett 2012-07-25 17:12:40 +00:00
parent e1ff5dca6b
commit a6bb6202b7
1 changed files with 3 additions and 43 deletions

View File

@ -9,38 +9,9 @@
*/
/**
* Back compat support for get_custom_header().
* New since WordPress version 3.4.
*
* To provide backward compatibility with previous versions, we
* will define our own version of this function.
*
* @todo Should this go into core instead?
*
* @return stdClass All properties represent attributes of the current header image.
*
* @package Twenty_Twelve
* @since Twenty Twelve 1.0
*/
if ( ! function_exists( 'get_custom_header' ) ) {
function get_custom_header() {
return (object) array(
'url' => get_header_image(),
'thumbnail_url' => get_header_image(),
'width' => HEADER_IMAGE_WIDTH,
'height' => HEADER_IMAGE_HEIGHT
);
}
}
/**
* Setup the WordPress core custom header arguments and settings.
* Set up the WordPress core custom header arguments and settings.
*
* Use add_theme_support() to register support for WordPress 3.4+
* as well as provide backward compatibility for previous versions.
*
* Use feature detection of wp_get_theme() which was introduced
* in WordPress 3.4.
*
* @uses twentytwelve_header_style()
* @uses twentytwelve_admin_header_style()
@ -72,19 +43,8 @@ function twentytwelve_custom_header_setup() {
'admin-preview-callback' => 'twentytwelve_admin_header_image',
);
// Allow child themes to filter any of these arguments.
$args = apply_filters( 'twentytwelve_custom_header_args', $args );
if ( function_exists( 'wp_get_theme' ) ) {
add_theme_support( 'custom-header', $args );
} else {
// Back compat for < 3.4 versions.
define( 'HEADER_TEXTCOLOR', $args['default-text-color'] );
define( 'HEADER_IMAGE', $args['default-image'] );
define( 'HEADER_IMAGE_WIDTH', $args['width'] );
define( 'HEADER_IMAGE_HEIGHT', $args['height'] );
add_custom_image_header( $args['wp-head-callback'], $args['admin-head-callback'], $args['admin-preview-callback'] );
}
// Add support and allow child themes to filter any of these arguments.
add_theme_support( 'custom-header', apply_filters( 'twentytwelve_custom_header_args', $args ) );
}
add_action( 'after_setup_theme', 'twentytwelve_custom_header_setup' );