Using the following code you can get a count of how many widgets are in a certain area
$the_sidebars = wp_get_sidebars_widgets(); $widget_count = count($the_sidebars['primary-aside']);
However, this doesn’t take into account whether the widgets that are being counted actually appear on the current page due to widget logic.
So $widget_count always equals however many widgets there are in the area primary-aside regardless to whether it’s actually being displayed or not.
How can I return a count that takes into account widget_logic on the widgets?
- The topic ‘[Plugin: Widget Logic] How do you return count of widgets, while considering widget_logic?’ is closed to new replies.