Make WordPress Core

Changeset 20218


Ignore:
Timestamp:
03/19/2012 09:14:41 PM (13 years ago)
Author:
nacin
Message:

Deprecate add_custom_image_header(), remove_custom_image_header(), add_custom_background(), remove_custom_background(). Replacements are add_theme_support() and remove_theme_support(). see #20249.

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/deprecated.php

    r20193 r20218  
    29822982    return wp_get_theme()->get('Name');
    29832983}
     2984
     2985/**
     2986 * Add callbacks for image header display.
     2987 *
     2988 * @since 2.1.0
     2989 * @deprecated 3.4.0
     2990 * @deprecated Use add_theme_support('custom-header', $args)
     2991 * @see add_theme_support()
     2992 *
     2993 * @param callback $callback Call on 'wp_head' action.
     2994 * @param callback $admin_header_callback Call on custom header administration screen.
     2995 * @param callback $admin_image_div_callback Output a custom header image div on the custom header administration screen. Optional.
     2996 */
     2997function add_custom_image_header( $callback, $admin_header_callback, $admin_image_div_callback = '' ) {
     2998    _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support(\'custom-header\', $args)' );
     2999    return add_theme_support( 'custom-header', array(
     3000        'callback' => $callback,
     3001        'admin-header-callback' => $admin_header_callback,
     3002        'admin-image-div-callback' => $admin_image_div_callback,
     3003    ) );
     3004}
     3005
     3006/**
     3007 * Remove image header support.
     3008 *
     3009 * @since 3.1.0
     3010 * @deprecated 3.4.0
     3011 * @deprecated Use remove_theme_support('custom-header')
     3012 * @see remove_theme_support()
     3013 *
     3014 * @return bool Whether support was removed.
     3015 */
     3016function remove_custom_image_header() {
     3017    _deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support(\'custom-header\')' );
     3018    return remove_theme_support( 'custom-header' );
     3019}
     3020
     3021/**
     3022 * Add callbacks for background image display.
     3023 *
     3024 * The parameter $header_callback callback will be required to display the
     3025 * content for the 'wp_head' action. The parameter $admin_header_callback
     3026 * callback will be added to Custom_Background class and that will be added
     3027 * to the 'admin_menu' action.
     3028 *
     3029 * @since 3.0.0
     3030 * @uses Custom_Background Sets up for $admin_header_callback for administration panel display.
     3031 *
     3032 * @param callback $callback Call on 'wp_head' action.
     3033 * @param callback $admin_header_callback Call on custom background administration screen.
     3034 * @param callback $admin_image_div_callback Output a custom background image div on the custom background administration screen. Optional.
     3035 */
     3036function add_custom_background( $callback = '', $admin_header_callback = '', $admin_image_div_callback = '' ) {
     3037    if ( $callback || $admin_header_callback || $admin_image_div_callback )
     3038        _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support(\'custom-background\', $args)' );
     3039    else
     3040        _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support(\'custom-background\')' );
     3041
     3042    return add_theme_support( 'custom-background', array(
     3043        'callback' => $callback,
     3044        'admin-header-callback' => $admin_header_callback,
     3045        'admin-image-div-callback' => $admin_image_div_callback,
     3046    ) );
     3047}
     3048
     3049/**
     3050 * Remove custom background support.
     3051 *
     3052 * @since 3.1.0
     3053 * @see add_custom_background()
     3054 *
     3055 * @return bool Whether support was removed.
     3056 */
     3057function remove_custom_background() {
     3058    _deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support(\'custom-background\')' );
     3059    return remove_theme_support( 'custom-background' );
     3060}
  • trunk/wp-includes/theme.php

    r20214 r20218  
    10841084
    10851085/**
    1086  * Add callbacks for image header display.
    1087  *
    1088  * @since 2.1.0
    1089  * @deprecated 3.4.0
    1090  * @deprecated Use add_theme_support('custom-header', $args)
    1091  * @see add_theme_support()
    1092  *
    1093  * @param callback $header_callback Call on 'wp_head' action.
    1094  * @param callback $admin_header_callback Call on custom header administration screen.
    1095  * @param callback $admin_image_div_callback Output a custom header image div on the custom header administration screen. Optional.
    1096  */
    1097 function add_custom_image_header( $header_callback, $admin_header_callback, $admin_image_div_callback = '' ) {
    1098     # _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support(\'custom-header\', $args)' );
    1099     return add_theme_support( 'custom-header', array(
    1100         'callback' => $header_callback,
    1101         'admin-header-callback' => $admin_header_callback,
    1102         'admin-image-div-callback' => $admin_image_div_callback,
    1103     ) );
    1104 }
    1105 
    1106 /**
    1107  * Remove image header support.
    1108  *
    1109  * @since 3.1.0
    1110  * @deprecated 3.4.0
    1111  * @deprecated Use remove_theme_support('custom-header')
    1112  * @see remove_theme_support()
    1113  *
    1114  * @return bool Whether support was removed.
    1115  */
    1116 function remove_custom_image_header() {
    1117     # _deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support(\'custom-header\')' );
    1118     return remove_theme_support( 'custom-header' );
    1119 }
    1120 
    1121 /**
    11221086 * Register a selection of default headers to be displayed by the custom header admin UI.
    11231087 *
     
    11941158function background_color() {
    11951159    echo get_background_color();
    1196 }
    1197 
    1198 /**
    1199  * Add callbacks for background image display.
    1200  *
    1201  * The parameter $header_callback callback will be required to display the
    1202  * content for the 'wp_head' action. The parameter $admin_header_callback
    1203  * callback will be added to Custom_Background class and that will be added
    1204  * to the 'admin_menu' action.
    1205  *
    1206  * @since 3.0.0
    1207  * @uses Custom_Background Sets up for $admin_header_callback for administration panel display.
    1208  *
    1209  * @param callback $header_callback Call on 'wp_head' action.
    1210  * @param callback $admin_header_callback Call on custom background administration screen.
    1211  * @param callback $admin_image_div_callback Output a custom background image div on the custom background administration screen. Optional.
    1212  */
    1213 function add_custom_background( $header_callback = '', $admin_header_callback = '', $admin_image_div_callback = '' ) {
    1214     # _deprecated_function( __FUNCTION__, '3.4', 'add_theme_support(\'custom-background\', $args)' );
    1215     return add_theme_support( 'custom-background', array(
    1216         'callback' => $header_callback,
    1217         'admin-header-callback' => $admin_header_callback,
    1218         'admin-image-div-callback' => $admin_image_div_callback,
    1219     ) );
    1220 }
    1221 
    1222 /**
    1223  * Remove custom background support.
    1224  *
    1225  * @since 3.1.0
    1226  * @see add_custom_background()
    1227  *
    1228  * @return bool Whether support was removed.
    1229  */
    1230 function remove_custom_background() {
    1231     # _deprecated_function( __FUNCTION__, '3.4', 'remove_theme_support(\'custom-background\')' );
    1232     return remove_theme_support( 'custom-background' );
    12331160}
    12341161
     
    15031430            $custom_background = new Custom_Background( $args[0]['admin-header-callback'], $args[0]['admin-image-div-callback'] );
    15041431        }
    1505     }       
     1432    }
    15061433}
    15071434add_action( 'wp_loaded', '_custom_header_background_just_in_time' );
Note: See TracChangeset for help on using the changeset viewer.