is_dynamic_sidebar()
is_dynamic_sidebar() 确定主题是否启用并使用动态侧边栏。Determines whethe…
is_dynamic_sidebar()
确定主题是否启用并使用动态侧边栏。
Determines whether the dynamic sidebar is enabled and used by the theme.
确定主题是否启用并使用动态侧边栏。
Determines whether the dynamic sidebar is enabled and used by the theme.
目录锚点:#说明#返回#源码
说明(Description)
有关此主题函数和类似主题函数的更多信息,请参阅主题开发人员手册中的条件标记文章。
返回(Return)
(bool)如果使用小部件,则为True。如果不使用小部件,则返回False。
源码(Source)
/**
* Whether the dynamic sidebar is enabled and used by theme.
*
* @since 2.2.0
*
* @global array $wp_registered_widgets
* @global array $wp_registered_sidebars
*
* @return bool True, if using widgets. False, if not using widgets.
*/
function is_dynamic_sidebar() {
global $wp_registered_widgets, $wp_registered_sidebars;
$sidebars_widgets = get_option('sidebars_widgets');
foreach ( (array) $wp_registered_sidebars as $index => $sidebar ) {
if ( count($sidebars_widgets[$index]) ) {
foreach ( (array) $sidebars_widgets[$index] as $widget )
if ( array_key_exists($widget, $wp_registered_widgets) )
return true;
}
}
return false;
}| 更新版本 | 源码位置 | 使用 | 被使用 |
|---|---|---|---|
| 2.2.0 | wp-includes/widgets.php:905 | 0 | 1 function |
类别:WordPress 函数手册、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。

还没有任何评论,赶紧来占个楼吧!