Reference › WP_Theme_JSON WP_Theme_JSON::get_preset_classes ( array $setting_nodes , string[] $origins ): string
Since 5.9.0
Source wp-includes/class-wp-theme-json.php:2445Description Parameters Return Uses Used by Source History Creates new rulesets as classes for each preset value such as:
Description .has-value-color { color: value; } .has-value-background-color { background-color: value; } .has-value-font-size { font-size: value; } .has-value-gradient-background { background: value; } :where(p).has-value-gradient-background { background: value; }
Parameters
$setting_nodesarray Nodes with settings.
$originsstring[] List of origins to process presets from. Return
string The new stylesheet. Uses · 2 _wp_array_get() Accesses an array in depth based on a path of keys. static::compute_preset_classes() Source View on Trac ↗ View on GitHub ↗
2445 protected function get_preset_classes ( $setting_nodes , $origins ) { 2446 $preset_rules = '' ; 2447 2448 foreach ( $setting_nodes as $metadata ) { 2449 if ( null === $metadata [ 'selector' ] ) { 2450 continue ; 2451 } 2452 2453 $selector = $metadata [ 'selector' ] ; 2454 $node = _wp_array_get ( $this -> theme_json , $metadata [ 'path' ] , array ( ) ) ; 2455 $preset_rules .= static :: compute_preset_classes ( $node , $selector , $origins ) ; 2456 } 2457 2458 return $preset_rules ; 2459 } History Introduced in 5.9.0 . Unchanged from 6.7.7 through 7.1.0.
6.7.7 6.8.8 6.9.7 7.0.4 7.1.0 Signature, return type and hooks compared across 5 parsed releases.
About this page Parsed data Generated from the wordpress-develop 7.1.0 tag, from src/wp-includes/class-wp-theme-json.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. Corrections Something wrong on this page? Report it and it gets fixed in the next regeneration.