Skip to content

Commit 23a1516

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@56225 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b892f51 commit 23a1516

1 file changed

Lines changed: 11 additions & 3 deletions

File tree

src/wp-includes/class-wp-duotone.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1180,9 +1180,17 @@ public static function output_footer_assets() {
11801180
echo self::get_svg_definitions( self::$used_svg_filter_data );
11811181
}
11821182

1183-
// 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.
1184-
if ( ! wp_is_block_theme() && ! empty( self::$used_global_styles_presets ) ) {
1185-
wp_add_inline_style( 'core-block-supports', self::get_global_styles_presets( self::$used_global_styles_presets ) );
1183+
// In block themes, the CSS is added in the head via wp_add_inline_style in the wp_enqueue_scripts action.
1184+
if ( ! wp_is_block_theme() ) {
1185+
$style_tag_id = 'core-block-supports-duotone';
1186+
wp_register_style( $style_tag_id, false );
1187+
if ( ! empty( self::$used_global_styles_presets ) ) {
1188+
wp_add_inline_style( $style_tag_id, self::get_global_styles_presets( self::$used_global_styles_presets ) );
1189+
}
1190+
if ( ! empty( self::$block_css_declarations ) ) {
1191+
wp_add_inline_style( $style_tag_id, wp_style_engine_get_stylesheet_from_css_rules( self::$block_css_declarations ) );
1192+
}
1193+
wp_enqueue_style( $style_tag_id );
11861194
}
11871195
}
11881196

0 commit comments

Comments
 (0)