WP_Customize_Widgets::tally_sidebars_via_is_active_sidebar_calls
Tallies the sidebars rendered via is_active_sidebar().
Keep track of the times that is_active_sidebar() is called in the template, and assume that this means that the sidebar would be rendered on the template if there were widgets populating it.
Метод класса: WP_Customize_Widgets{}
Хуков нет.
Возвращает
true|false. Whether the sidebar is active.
Использование
$WP_Customize_Widgets = new WP_Customize_Widgets(); $WP_Customize_Widgets->tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id );
- $is_active(true|false) (обязательный)
- Whether the sidebar is active.
- $sidebar_id(строка) (обязательный)
- Sidebar ID.
Список изменений
| С версии 3.9.0 | Введена. |
Код WP_Customize_Widgets::tally_sidebars_via_is_active_sidebar_calls() WP Customize Widgets::tally sidebars via is active sidebar calls WP 6.9.1
public function tally_sidebars_via_is_active_sidebar_calls( $is_active, $sidebar_id ) {
if ( is_registered_sidebar( $sidebar_id ) ) {
$this->rendered_sidebars[ $sidebar_id ] = true;
}
/*
* We may need to force this to true, and also force-true the value
* for 'dynamic_sidebar_has_widgets' if we want to ensure that there
* is an area to drop widgets into, if the sidebar is empty.
*/
return $is_active;
}