wpseek.com
WordPress开发者和主题制作者的搜索引擎
is_active_sidebar › WordPress Function
Since2.8.0
已弃用n/a
› is_active_sidebar ( $index )
参数: |
|
返回: |
|
定义在: |
|
文档: |
Determines whether a sidebar contains widgets.
For more information on this and similar theme functions, check out the {@link Conditional Tags} article in the Theme Developer Handbook.Related Functions: is_active_widget, is_dynamic_sidebar, register_sidebar, register_sidebars, unregister_sidebar
源码
function is_active_sidebar( $index ) { $index = ( is_int( $index ) ) ? "sidebar-$index" : sanitize_title( $index ); $sidebars_widgets = wp_get_sidebars_widgets(); $is_active_sidebar = ! empty( $sidebars_widgets[ $index ] ); /** * Filters whether a dynamic sidebar is considered "active". * * @since 3.9.0 * * @param bool $is_active_sidebar Whether or not the sidebar should be considered "active". * In other words, whether the sidebar contains any widgets. * @param int|string $index Index, name, or ID of the dynamic sidebar. */ return apply_filters( 'is_active_sidebar', $is_active_sidebar, $index ); }