W3cubDocs

/WordPress

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.

Parameters

$index

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

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 ), intval( $this->sidebar_instance_count[ $index ] ) );
		}
	}

Changelog

Version Description
4.5.0 Introduced.

© 2003–2019 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_customize_widgets/start_dynamic_sidebar