From 359ed454b787c2092e0a5a330a95eb446ff97312 Mon Sep 17 00:00:00 2001 From: nacin Date: Wed, 21 Mar 2012 03:36:17 +0000 Subject: [PATCH] Callbacks for custom headers and custom backgrounds registered through add_theme_support() are now wp-head-callback, admin-head-callback, and admin-preview-callback. see #19910. git-svn-id: http://svn.automattic.com/wordpress/trunk@20231 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-content/themes/twentyeleven/functions.php | 6 ++-- wp-content/themes/twentyten/functions.php | 2 +- wp-includes/deprecated.php | 37 +++++++++----------- wp-includes/theme.php | 31 ++++++++-------- 4 files changed, 35 insertions(+), 41 deletions(-) diff --git a/wp-content/themes/twentyeleven/functions.php b/wp-content/themes/twentyeleven/functions.php index b93b0212f4..5ae5d24352 100644 --- a/wp-content/themes/twentyeleven/functions.php +++ b/wp-content/themes/twentyeleven/functions.php @@ -118,11 +118,11 @@ function twentyeleven_setup() { // Random image rotation by default. 'random-default' => true, // Callback for styling the header. - 'callback' => 'twentyeleven_header_style', + 'wp-head-callback' => 'twentyeleven_header_style', // Callback for styling the header preview in the admin. - 'admin-header-callback' => 'twentyeleven_admin_header_style', + 'admin-head-callback' => 'twentyeleven_admin_header_style', // Callback used to display the header preview in the admin. - 'admin-image-div-callback' => 'twentyeleven_admin_header_image', + 'admin-preview-callback' => 'twentyeleven_admin_header_image', ) ); // We'll be using post thumbnails for custom header images on posts and pages. diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php index 013516c8fe..c619bf0802 100644 --- a/wp-content/themes/twentyten/functions.php +++ b/wp-content/themes/twentyten/functions.php @@ -113,7 +113,7 @@ function twentyten_setup() { // Don't support text inside the header image. 'header-text' => false, // Callback for styling the header preview in the admin. - 'admin-header-callback' => 'twentyten_admin_header_style', + 'admin-head-callback' => 'twentyten_admin_header_style', ) ); // We'll be using post thumbnails for custom header images on posts and pages. diff --git a/wp-includes/deprecated.php b/wp-includes/deprecated.php index b1dbb64046..1a8d414765 100644 --- a/wp-includes/deprecated.php +++ b/wp-includes/deprecated.php @@ -2990,16 +2990,16 @@ function get_current_theme() { * @deprecated Use add_theme_support('custom-header', $args) * @see add_theme_support() * - * @param callback $callback Call on 'wp_head' action. - * @param callback $admin_header_callback Call on custom header administration screen. - * @param callback $admin_image_div_callback Output a custom header image div on the custom header administration screen. Optional. + * @param callback $wp_head_callback Call on 'wp_head' action. + * @param callback $admin_head_callback Call on custom header administration screen. + * @param callback $admin_preview_callback Output a custom header image div on the custom header administration screen. Optional. */ -function add_custom_image_header( $callback, $admin_header_callback, $admin_image_div_callback = '' ) { +function add_custom_image_header( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-header\', $args )' ); return add_theme_support( 'custom-header', array( - 'callback' => $callback, - 'admin-header-callback' => $admin_header_callback, - 'admin-image-div-callback' => $admin_image_div_callback, + 'wp-head-callback' => $wp_head_callback, + 'admin-head-callback' => $admin_head_callback, + 'admin-preview-callback' => $admin_preview_callback, ) ); } @@ -3021,25 +3021,22 @@ function remove_custom_image_header() { /** * Add callbacks for background image display. * - * The parameter $header_callback callback will be required to display the - * content for the 'wp_head' action. The parameter $admin_header_callback - * callback will be added to Custom_Background class and that will be added - * to the 'admin_menu' action. - * * @since 3.0.0 - * @uses Custom_Background Sets up for $admin_header_callback for administration panel display. + * @deprecated 3.4.0 + * @deprecated Use add_theme_support('custom-background, $args) + * @see add_theme_support() * - * @param callback $callback Call on 'wp_head' action. - * @param callback $admin_header_callback Call on custom background administration screen. - * @param callback $admin_image_div_callback Output a custom background image div on the custom background administration screen. Optional. + * @param callback $wp_head_callback Call on 'wp_head' action. + * @param callback $admin_head_callback Call on custom background administration screen. + * @param callback $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional. */ -function add_custom_background( $callback = '', $admin_header_callback = '', $admin_image_div_callback = '' ) { +function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) { _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( \'custom-background\', $args )' ); return add_theme_support( 'custom-background', array( - 'callback' => $callback, - 'admin-header-callback' => $admin_header_callback, - 'admin-image-div-callback' => $admin_image_div_callback, + 'wp-head-callback' => $wp_head_callback, + 'admin-head-callback' => $admin_head_callback, + 'admin-preview-callback' => $admin_preview_callback, ) ); } diff --git a/wp-includes/theme.php b/wp-includes/theme.php index 1026151dff..97be97091d 100644 --- a/wp-includes/theme.php +++ b/wp-includes/theme.php @@ -1296,9 +1296,9 @@ function add_theme_support( $feature ) { 'default-text-color' => '', 'header-text' => true, 'uploads' => true, - 'callback' => '', - 'admin-header-callback' => '', - 'admin-image-div-callback' => '', + 'wp-head-callback' => '', + 'admin-head-callback' => '', + 'admin-preview-callback' => '', ); $jit = isset( $args[0]['__jit'] ); @@ -1366,9 +1366,9 @@ function add_theme_support( $feature ) { $defaults = array( 'default-image' => '', 'default-color' => '', - 'callback' => '', - 'admin-header-callback' => '', - 'admin-image-div-callback' => '', + 'wp-head-callback' => '_custom_background_cb', + 'admin-head-callback' => '', + 'admin-preview-callback' => '', ); $jit = isset( $args[0]['__jit'] ); @@ -1391,9 +1391,6 @@ function add_theme_support( $feature ) { elseif ( isset( $args[0]['default-image'] ) || $jit ) define( 'BACKGROUND_IMAGE', $args[0]['default-image'] ); - if ( empty( $args[0]['callback'] ) ) - $args[0]['callback'] = '_custom_background_cb'; - break; } @@ -1414,12 +1411,12 @@ function _custom_header_background_just_in_time() { add_theme_support( 'custom-header', array( '__jit' => true ) ); $args = get_theme_support( 'custom-header' ); - if ( $args[0]['callback'] ) - add_action( 'wp_head', $args[0]['callback'] ); + if ( $args[0]['wp-head-callback'] ) + add_action( 'wp_head', $args[0]['wp-head-callback'] ); if ( is_admin() ) { require_once( ABSPATH . 'wp-admin/custom-header.php' ); - $custom_image_header = new Custom_Image_Header( $args[0]['admin-header-callback'], $args[0]['admin-image-div-callback'] ); + $custom_image_header = new Custom_Image_Header( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] ); } } @@ -1428,11 +1425,11 @@ function _custom_header_background_just_in_time() { add_theme_support( 'custom-background', array( '__jit' => true ) ); $args = get_theme_support( 'custom-background' ); - add_action( 'wp_head', $args[0]['callback'] ); + add_action( 'wp_head', $args[0]['wp-head-callback'] ); if ( is_admin() ) { require_once( ABSPATH . 'wp-admin/custom-background.php' ); - $custom_background = new Custom_Background( $args[0]['admin-header-callback'], $args[0]['admin-image-div-callback'] ); + $custom_background = new Custom_Background( $args[0]['admin-head-callback'], $args[0]['admin-preview-callback'] ); } } } @@ -1509,15 +1506,15 @@ function _remove_theme_support( $feature ) { switch ( $feature ) { case 'custom-header' : $support = get_theme_support( 'custom-header' ); - if ( $support[0]['callback'] ) - remove_action( 'wp_head', $support[0]['callback'] ); + if ( $support[0]['wp-head-callback'] ) + remove_action( 'wp_head', $support[0]['wp-head-callback'] ); remove_action( 'admin_menu', array( $GLOBALS['custom_image_header'], 'init' ) ); unset( $GLOBALS['custom_image_header'] ); break; case 'custom-background' : $support = get_theme_support( 'custom-background' ); - remove_action( 'wp_head', $support[0]['callback'] ); + remove_action( 'wp_head', $support[0]['wp-head-callback'] ); remove_action( 'admin_menu', array( $GLOBALS['custom_background'], 'init' ) ); unset( $GLOBALS['custom_background'] ); break;