From 059ce0044243b70d38bb75ca2104f5290784b89f Mon Sep 17 00:00:00 2001 From: isabel_brison Date: Thu, 13 Jul 2023 04:16:26 +0000 Subject: [PATCH] Editor: fix duotone filters in classic themes. Makes sure duotone block styles are output in the front end on classic themes. Props ajlende, jeryj, spacedmonkey, vivekawsm, sabernhardt, costdev, mrinal013. Fixes #58734. Built from https://develop.svn.wordpress.org/trunk@56225 git-svn-id: http://core.svn.wordpress.org/trunk@55737 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-duotone.php | 14 +++++++++++--- wp-includes/version.php | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/wp-includes/class-wp-duotone.php b/wp-includes/class-wp-duotone.php index 99da521f06..b29f38acf5 100644 --- a/wp-includes/class-wp-duotone.php +++ b/wp-includes/class-wp-duotone.php @@ -1180,9 +1180,17 @@ class WP_Duotone { echo self::get_svg_definitions( self::$used_svg_filter_data ); } - // This is for classic themes - in block themes, the CSS is added in the head via wp_add_inline_style in the wp_enqueue_scripts action. - if ( ! wp_is_block_theme() && ! empty( self::$used_global_styles_presets ) ) { - wp_add_inline_style( 'core-block-supports', self::get_global_styles_presets( self::$used_global_styles_presets ) ); + // In block themes, the CSS is added in the head via wp_add_inline_style in the wp_enqueue_scripts action. + if ( ! wp_is_block_theme() ) { + $style_tag_id = 'core-block-supports-duotone'; + wp_register_style( $style_tag_id, false ); + if ( ! empty( self::$used_global_styles_presets ) ) { + wp_add_inline_style( $style_tag_id, self::get_global_styles_presets( self::$used_global_styles_presets ) ); + } + if ( ! empty( self::$block_css_declarations ) ) { + wp_add_inline_style( $style_tag_id, wp_style_engine_get_stylesheet_from_css_rules( self::$block_css_declarations ) ); + } + wp_enqueue_style( $style_tag_id ); } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 8532e168c5..285e039b34 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-beta4-56224'; +$wp_version = '6.3-beta4-56225'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.