W3cubDocs

/WordPress

WP_Theme_JSON::update_separator_declarations( array $declarations ): array

Returns a filtered declarations array if there is a separator block with only a background style defined in theme.json by adding a color attribute to reflect the changes in the front.

Parameters

$declarationsarrayrequired
List of declarations.

Return

array $declarations List of declarations filtered.

Source


	return $declarations;
}

/**
 * Given an array of settings, extracts the CSS Custom Properties
 * for the custom values and adds them to the $declarations
 * array following the format:
 *
 *     array(
 *       'name'  => 'property_name',
 *       'value' => 'property_value,
 *     )
 *
 * @since 5.8.0
 *
 * @param array $settings Settings to process.
 * @return array The modified $declarations.
 */
protected static function compute_theme_vars( $settings ) {
	$declarations  = array();
	$custom_values = isset( $settings['custom'] ) ? $settings['custom'] : array();
	$css_vars      = static::flatten_tree( $custom_values );
	foreach ( $css_vars as $key => $value ) {
		$declarations[] = array(
			'name'  => '--wp--custom--' . $key,
			'value' => $value,
		);

Changelog

Version Description
6.1.1 Introduced.

© 2003–2024 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/classes/wp_theme_json/update_separator_declarations