From b67963cc7568f27c5b8da2393e7ce2e9a1809342 Mon Sep 17 00:00:00 2001 From: Ari Stathopoulos Date: Tue, 19 Jul 2022 15:14:13 +0300 Subject: [PATCH] short and sweet --- lib/compat/wordpress-6.1/script-loader.php | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/lib/compat/wordpress-6.1/script-loader.php b/lib/compat/wordpress-6.1/script-loader.php index c63db102bf243..658bd0e3b349d 100644 --- a/lib/compat/wordpress-6.1/script-loader.php +++ b/lib/compat/wordpress-6.1/script-loader.php @@ -23,10 +23,7 @@ * @param int $priority To set the priority for the add_action. */ function gutenberg_enqueue_block_support_styles( $style, $priority = 10 ) { - $action_hook_name = 'wp_footer'; - if ( wp_is_block_theme() ) { - $action_hook_name = 'wp_head'; - } + $action_hook_name = wp_is_block_theme() ? 'wp_head' : 'wp_footer'; add_action( $action_hook_name, static function () use ( $style ) { @@ -43,16 +40,13 @@ static function () use ( $style ) { * @param string $store_name The name of the store. */ function gutenberg_enqueue_style_engine_store( $store_name ) { - $action_hook_name = 'wp_footer'; - if ( wp_is_block_theme() ) { - $action_hook_name = 'wp_head'; - } + $action_hook_name = wp_is_block_theme() ? 'wp_head' : 'wp_footer'; add_action( $action_hook_name, static function () use ( $store_name ) { - $store = WP_Style_Engine_CSS_Rules_Store_Gutenberg::get_store( $store_name ); - $processor = new WP_Style_Engine_Processor_Gutenberg( $store ); - $css = $processor->get_css( true ); + $css = ( new WP_Style_Engine_Processor_Gutenberg( + WP_Style_Engine_CSS_Rules_Store_Gutenberg::get_store( $store_name ) + ) )->get_css( true ); if ( $css ) { echo ''; }