WP_Customize_Widgets::tally_sidebars_via_dynamic_sidebar_calls( bool $has_widgets, string $sidebar_id )

Tallies the sidebars rendered via dynamic_sidebar().


Description Description

Keep track of the times that dynamic_sidebar() is called in the template, and assume this means the sidebar would be rendered on the template if there were widgets populating it.


Parameters Parameters

$has_widgets

(bool) (Required) Whether the current sidebar has widgets.

$sidebar_id

(string) (Required) Sidebar ID.


Top ↑

Return Return

(bool) Whether the current sidebar has widgets.


Top ↑

Source Source

File: wp-includes/class-wp-customize-widgets.php

	public function tally_sidebars_via_dynamic_sidebar_calls( $has_widgets, $sidebar_id ) {
		if ( is_registered_sidebar( $sidebar_id ) ) {
			$this->rendered_sidebars[] = $sidebar_id;
		}

		/*
		 * We may need to force this to true, and also force-true the value
		 * for 'is_active_sidebar' if we want to ensure there is an area to
		 * drop widgets into, if the sidebar is empty.
		 */
		return $has_widgets;
	}

Top ↑

Changelog Changelog

Changelog
Version Description
3.9.0 Introduced.


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.