mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-05 10:22:23 +01:00
Add is_active_sidebar(), props filosofo, fixes #4594
git-svn-id: http://svn.automattic.com/wordpress/trunk@11134 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
f7a6290580
commit
05e168fd95
@ -850,6 +850,23 @@ function is_dynamic_sidebar() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether a sidebar is in use.
|
||||
*
|
||||
* @since 2.8
|
||||
*
|
||||
* @param mixed $index, sidebar name, id or number to check.
|
||||
* @return bool true if the sidebar is in use, false otherwise.
|
||||
*/
|
||||
function is_active_sidebar( $index ) {
|
||||
$index = ( is_int($index) ) ? "sidebar-$index" : sanitize_title($index);
|
||||
$sidebars_widgets = get_option( 'sidebars_widgets', array() );
|
||||
if ( isset($sidebars_widgets[$index]) && !empty($sidebars_widgets[$index]) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Internal Functions */
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user