add_custom_background

函数
add_custom_background ( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' )
参数
  • (callable) $wp_head_callback Call on the {@see 'wp_head'} action.
    Required:
    Default: (empty)
  • (callable) $admin_head_callback Call on custom background administration screen.
    Required:
    Default: (empty)
  • (callable) $admin_preview_callback Output a custom background image div on the custom background administration screen. Optional.
    Required:
    Default: (empty)
相关
  • add_theme_support()
定义位置
相关方法
_custom_background_cbremove_custom_backgroundadd_custom_image_header_custom_header_background_just_in_timeget_background_image
引入
3.0.0
弃用
3.4.0

add_custom_background: 这个函数在WordPress主题中增加对自定义背景图片的支持: 该函数接收一个定义背景图片属性的参数数组。

增加背景图片显示的回调。

function add_custom_background( $wp_head_callback = '', $admin_head_callback = '', $admin_preview_callback = '' ) {
	_deprecated_function( __FUNCTION__, '3.4.0', '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 );
}

常见问题

FAQs
查看更多 >
闪电侠

(工作日 10:00 - 18:30 为您服务)

2025-12-14 12:36:31

您好,无论是售前、售后、意见建议……均可通过联系工单与我们取得联系。

您也可选择聊天工具与我们即时沟通或点击查看:

您的工单我们已经收到,我们将会尽快跟您联系!
取消
选择聊天工具: