WP_Customize_Widgets::start_dynamic_sidebar() WordPress Method

The start_dynamic_sidebar() method is used to begin rendering a dynamic sidebar. This method is called by the dynamic_sidebar() function.

WP_Customize_Widgets::start_dynamic_sidebar( int|string $index ) #

Begins keeping track of the current sidebar being rendered.


Description

Insert marker before widgets are rendered in a dynamic sidebar.


Top ↑

Parameters

$index

(int|string)(Required)Index, name, or ID of the dynamic sidebar.


Top ↑

Source

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

	public function start_dynamic_sidebar( $index ) {
		array_unshift( $this->current_dynamic_sidebar_id_stack, $index );
		if ( ! isset( $this->sidebar_instance_count[ $index ] ) ) {
			$this->sidebar_instance_count[ $index ] = 0;
		}
		$this->sidebar_instance_count[ $index ] += 1;
		if ( ! $this->manager->selective_refresh->is_render_partials_request() ) {
			printf( "\n<!--dynamic_sidebar_before:%s:%d-->\n", esc_html( $index ), (int) $this->sidebar_instance_count[ $index ] );
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
4.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.