WP_Theme_JSON::get_css_variables( array $nodes, string[] $origins ): string

Converts each styles section into a list of rulesets to be appended to the stylesheet.

Description

These rulesets contain all the css variables (custom variables and preset variables).

See glossary at https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax

For each section this creates a new ruleset such as:

block-selector {
  --wp--preset--category--slug: value;
  --wp--custom--variable: value;
}

Parameters

$nodesarrayrequired
Nodes with settings.
$originsstring[]required
List of origins to process.

Return

string The new stylesheet.

Source

		$preset_rules .= static::compute_preset_classes( $node, $selector, $origins );
	}

	return $preset_rules;
}

/**
 * Converts each styles section into a list of rulesets
 * to be appended to the stylesheet.
 * These rulesets contain all the css variables (custom variables and preset variables).
 *
 * See glossary at https://developer.mozilla.org/en-US/docs/Web/CSS/Syntax
 *
 * For each section this creates a new ruleset such as:
 *
 *     block-selector {
 *       --wp--preset--category--slug: value;
 *       --wp--custom--variable: value;
 *     }
 *
 * @since 5.8.0

Changelog

VersionDescription
5.9.0Added the $origins parameter.
5.8.0Introduced.

User Contributed Notes

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