Skip to content

Commit

Permalink
short and sweet
Browse files Browse the repository at this point in the history
  • Loading branch information
aristath committed Jul 19, 2022
1 parent 7aa60b5 commit b67963c
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions lib/compat/wordpress-6.1/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) {
Expand All @@ -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 '<style id="wp-style-engine-' . esc_attr( str_replace( '/', '-', $store_name ) ) . '">' . $css . '</style>';
}
Expand Down

0 comments on commit b67963c

Please sign in to comment.