WP_Duotone::get_global_styles_presets()
Get the CSS for global styles.
Example output: body{--wp--preset--duotone--blue-orange:url('#wp-duotone-blue-orange');}
Method of the class: WP_Duotone{}
No Hooks.
Return
String
. The CSS for global styles.
Usage
$result = WP_Duotone::get_global_styles_presets( $sources );
- $sources(array) (required)
- The duotone presets.
Changelog
Since 6.3.0 | Introduced. |
Since 6.6.0 | Replaced body selector with WP_Theme_JSON::ROOT_CSS_PROPERTIES_SELECTOR. |
WP_Duotone::get_global_styles_presets() WP Duotone::get global styles presets code WP 6.6.2
private static function get_global_styles_presets( $sources ) { $css = WP_Theme_JSON::ROOT_CSS_PROPERTIES_SELECTOR . '{'; foreach ( $sources as $filter_id => $filter_data ) { $slug = $filter_data['slug']; $colors = $filter_data['colors']; $css_property_name = self::get_css_custom_property_name( $slug ); $declaration_value = is_string( $colors ) ? $colors : self::get_filter_url( $filter_id ); $css .= "$css_property_name:$declaration_value;"; } $css .= '}'; return $css; }