Skip to content

Commit

Permalink
Duotone: Backport from Core to fix filters in classic themes (#54778)
Browse files Browse the repository at this point in the history
Co-authored-by: Alex Lende <[email protected]>
  • Loading branch information
t-hamano and ajlende authored Nov 20, 2023
1 parent 5cfe094 commit 0253471
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lib/class-wp-duotone-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -938,9 +938,17 @@ public static function output_footer_assets() {
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, gutenberg_style_engine_get_stylesheet_from_css_rules( self::$block_css_declarations ) );
}
wp_enqueue_style( $style_tag_id );
}
}

Expand Down

0 comments on commit 0253471

Please sign in to comment.