add_custom_background()自定义背景

目录

描述

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.

add_custom_background() 描述

用法

<?php add_custom_background$header_callback$admin_header_callback$admin_image_div_callback ?>

add_custom_background() 用法

参数

$header_callback

(callback) (可选) Call on 'wp_head' action.

默认值: ''

$admin_header_callback

(callback) (可选) Call on custom background administration screen.

默认值: ''

$admin_image_div_callback

(callback) (可选) Output a custom background image div on the custom background administration screen. Optional.

默认值: ''

add_custom_background() 参数

返回值

(void) 

This function does not return a value.

add_custom_background() 返回值

注意

  • 使用到: Custom_Background Sets up for $admin_header_callback for administration panel display.

add_custom_background() 注意

历史

add_custom_background() 历史

源文件

add_custom_background() 函数的代码位于 wp-includes/deprecated.php.

/* ----------------------------------
 * wordpress之魂 © http://wphun.com
 * ---------------------------------- */
/**
 * Add callbacks for background image display.
 *
 * @since 3.0.0
 * @deprecated 3.4.0
 * @deprecated Use add_theme_support('custom-background, $args)
 * @see add_theme_support()
 *
 * @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( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) {
	_deprecated_function( __FUNCTION__, '3.4', 'add_theme_support( 'custom-background', $args )' );
	$args = array();
	if ( $wp_head_callback )
		$args['wp-head-callback'] = $wp_head_callback;
	if ( $admin_head_callback )
		$args['admin-head-callback'] = $admin_head_callback;
	if ( $admin_preview_callback )
		$args['admin-preview-callback'] = $admin_preview_callback;
	return add_theme_support( 'custom-background', $args );
}

add_custom_background() 源文件

相关