WordPress函数文档add_custom_background()
自定义背景 描述 Add callbacks for background image display. Th…
自定义背景
描述
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.
用法
<?php add_custom_background( $header_callback, $admin_header_callback, $admin_image_div_callback ) ?>
参数
$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.
默认值: ”
返回值
(void)
This function does not return a value.
注意
- 使用到: Custom_Background Sets up for $admin_header_callback for administration panel display.
历史
- Deprecated: 3.4.0
- 添加于 版本: 3.0.0
源文件
add_custom_background() 函数的代码位于 wp-includes/deprecated.php
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
/**
* 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 );
}
|
相关
- Theme Review – Guidelines (recommended)
Theme Support:
add_theme_support(),
remove_theme_support(),
current_theme_supports()
Theme Features:
sidebar,
menus,
post-formats,
title-tag,
custom-background,
custom-header,
post-thumbnails,
automatic-feed-links,
html5,
editor-style,
content_width
Further Reading – External Resources
- Apply custom background on other element rather than <body> element
- 原文:http://codex.wordpress.org/Function_Reference/add_custom_background
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!