WP_Theme_JSON::compute_theme_vars( array $settings )

Given an array of settings, it extracts the CSS Custom Properties for the custom values and adds them to the $declarations array following the format:


Description

array( ‘name’ => ‘property_name’, ‘value’ => ‘property_value, )


Top ↑

Parameters

$settings

(array) (Required) Settings to process.


Top ↑

Return

(array) Returns the modified $declarations.


Top ↑

Source

File: wp-includes/class-wp-theme-json.php

	private static function compute_theme_vars( $settings ) {
		$declarations  = array();
		$custom_values = _wp_array_get( $settings, array( 'custom' ), array() );
		$css_vars      = self::flatten_tree( $custom_values );
		foreach ( $css_vars as $key => $value ) {
			$declarations[] = array(
				'name'  => '--wp--custom--' . $key,
				'value' => $value,
			);
		}

		return $declarations;
	}


Top ↑

Changelog

Changelog
Version Description
5.8.0 Introduced.

Top ↑

User Contributed Notes

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