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:1858Description 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; } 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 ↗
1858 protected function get_preset_classes ( $setting_nodes , $origins ) { 1859 $preset_rules = '' ; 1860 1861 foreach ( $setting_nodes as $metadata ) { 1862 if ( null === $metadata [ 'selector' ] ) { 1863 continue ; 1864 } 1865 1866 $selector = $metadata [ 'selector' ] ; 1867 $node = _wp_array_get ( $this -> theme_json , $metadata [ 'path' ] , array ( ) ) ; 1868 $preset_rules .= static :: compute_preset_classes ( $node , $selector , $origins ) ; 1869 } 1870 1871 return $preset_rules ; 1872 } 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 6.9.7 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.