WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

WP_Customize_Selective_Refresh::add_partial() WP 4.5.0

Adds a partial.

Это метод класса: WP_Customize_Selective_Refresh


WP_Customize_Partial. The instance of the panel that was added.


$WP_Customize_Selective_Refresh = new WP_Customize_Selective_Refresh();
$var = $WP_Customize_Selective_Refresh->add_partial( $id, $args );
$id(WP_Customize_Partial/строка) (обязательный)
Customize Partial object, or Panel ID.

Array of properties for the new Partials object.

  • $type (строка)
    Type of the partial to be created.

  • $selector (строка)
    The jQuery selector to find the container element for the partial, that is, a partial's placement.

  • $settings (массив)
    IDs for settings tied to the partial.

  • $primary_setting (строка)
    The ID for the setting that this partial is primarily responsible for rendering. If not supplied, it will default to the ID of the first setting.

  • $capability (строка)
    Capability required to edit this partial. Normally this is empty and the capability is derived from the capabilities of the associated $settings.

  • $render_callback (callable)
    Render callback. Callback is called with one argument, the instance of WP_Customize_Partial. The callback can either echo the partial or return the partial as a string, or return false if error.

  • $container_inclusive (true/false)
    Whether the container element is included in the partial, or if only the contents are rendered.

  • $fallback_refresh (true/false)
    Whether to refresh the entire preview in case a partial cannot be refreshed. A partial render is considered a failure if the render_callback returns false.

По умолчанию: empty array

Список изменений

С версии 4.5.0 Введена.

Код WP Customize Selective Refresh::add partial: wp-includes/customize/class-wp-customize-selective-refresh.php WP 5.4.2

public function add_partial( $id, $args = array() ) {
	if ( $id instanceof WP_Customize_Partial ) {
		$partial = $id;
	} else {
		$class = 'WP_Customize_Partial';

		/** This filter is documented in wp-includes/customize/class-wp-customize-selective-refresh.php */
		$args = apply_filters( 'customize_dynamic_partial_args', $args, $id );

		/** This filter is documented in wp-includes/customize/class-wp-customize-selective-refresh.php */
		$class = apply_filters( 'customize_dynamic_partial_class', $class, $id, $args );

		$partial = new $class( $this, $id, $args );

	$this->partials[ $partial->id ] = $partial;
	return $partial;