WP_Theme_JSON::convert_variables_to_value( array $styles, array $values ): array

In this article

This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.

Replaces CSS variables with their values in place.

Parameters

$stylesarrayrequired
CSS declarations to convert.
$valuesarrayrequired
key => value pairs to use for replacement.

Return

array

Source

	}

	if ( isset( $settings['gradients'] ) ) {
		$theme_settings['settings']['color']['gradients'] = $settings['gradients'];
	}

	if ( isset( $settings['fontSizes'] ) ) {
		$font_sizes = $settings['fontSizes'];
		// Back-compatibility for presets without units.
		foreach ( $font_sizes as $key => $font_size ) {
			if ( is_numeric( $font_size['size'] ) ) {
				$font_sizes[ $key ]['size'] = $font_size['size'] . 'px';
			}
		}
		$theme_settings['settings']['typography']['fontSizes'] = $font_sizes;
	}

	if ( isset( $settings['enableCustomSpacing'] ) ) {
		$theme_settings['settings']['spacing']['padding'] = $settings['enableCustomSpacing'];
	}

	if ( isset( $settings['spacingSizes'] ) ) {
		$theme_settings['settings']['spacing']['spacingSizes'] = $settings['spacingSizes'];
	}

	return $theme_settings;
}

/**
 * Returns the current theme's wanted patterns(slugs) to be
 * registered from Pattern Directory.
 *
 * @since 6.0.0
 *
 * @return string[]
 */
public function get_patterns() {

Changelog

VersionDescription
6.3.0Introduced.

User Contributed Notes

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