Dyad 2: Update how widgets are counted, to exclude the non visible ones (Cookies and Mailchimp). Fixes #287.
This commit is contained in:
parent
9ad17a39c7
commit
a194f1804e
1 changed files with 7 additions and 1 deletions
|
@ -191,7 +191,13 @@ function dyad_2_count_widgets( $id ) {
|
|||
$sidebars_widgets = wp_get_sidebars_widgets();
|
||||
|
||||
if ( array_key_exists( $id, $sidebars_widgets ) ) {
|
||||
$count = ( int ) count( ( array ) $sidebars_widgets[ $id ] );
|
||||
|
||||
foreach ( ( array ) $sidebars_widgets[ $id ] as $value ) {
|
||||
// Don't count the Cookies or Mailchimp widgets, since they're not visible in the widget area.
|
||||
if ( strpos( $value, 'eu_cookie_law_widget' ) === 0 || strpos( $value, 'widget_mailchimp_subscriber_popup' ) === 0 ) {
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return $count;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue