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');}
Метод класса: WP_Duotone{}
Хуков нет.
Возвращает
Строку
. The CSS for global styles.
Использование
$result = WP_Duotone::get_global_styles_presets( $sources );
- $sources(массив) (обязательный)
- The duotone presets.
Список изменений
С версии 6.3.0 | Введена. |
С версии 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 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; }