Adding classes to dynamic sidebar

You haven’t actually said what the problem is. But I can see one for starters – dynamic_sidebar in your if conditions will echo out the widgets immediately. If you want to check a sidebar has widgets, use is_active_sidebar:

is_active_sidebar( 'sidebar-1' ); // True/false

Leave a Comment