Tag Info

Hot answers tagged

2

You could add this function to your functions.php file. add_filter( 'sidebars_widgets', 'disable_all_widgets' ); function disable_all_widgets( $sidebars_widgets ) { $sidebars_widgets = array( false ); return $sidebars_widgets; } You could also use the Wordpress conditional tags to disable widgets only on certain pages. For example; this would only ...


1

Use the array_filter() function, which will remove every array element that has false as the value. Then you can count the array length. So your example would look like this: $sidebars = array( is_active_sidebar( 'footer-4' ), is_active_sidebar( 'footer-3' ), is_active_sidebar( 'footer-2' ), is_active_sidebar( 'footer-1' ), ...



Only top voted, non community-wiki answers of a minimum length are eligible