Methods → isAreaActive
Checks if a widget area is active, ie. not empty. Similar to is_active_sidebar, but this one also checks for any widget output. For example a sidebar can have a single Atom Posts widget which is set to display only posts related to the current context. If the widget doesn’t find any related posts, IsAreaActive() will consider that it doesn’t exist in the sidebar, and mark it as inactive. In design preview mode, all areas are considered to be visible, regardless of their contents.
Note that this function can return both boolean FALSE (no preview mode & no active widgets), and a non-boolean value which evaluates as FALSE like 0 (preview mode & no active widgets). To avoid confusion use the (not) identical operator (!== or ===).
int | bool atom()->isAreaActive($area)
- Area (sidebar) ID, required
<?php if(atom()->isAreaActive('my_sidebar') !== FALSE): ?> <ul class="my-widgets"> <?php atom()->Widgets('my_sidebar'); ?> </ul> <?php endif; ?>