Skip to content

Commit

Permalink
For block themes, print stored styles in the header.
Browse files Browse the repository at this point in the history
For classic themes, in the footer.
  • Loading branch information
ramonjd committed Aug 9, 2022
1 parent e9bf336 commit 13785f1
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/compat/wordpress-6.1/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,20 @@ static function () use ( $style ) {
* Styles are stored via the style engine API. See: packages/style-engine/README.md
*/
function gutenberg_enqueue_stored_styles() {
$is_block_theme = wp_is_block_theme();
$is_classic_theme = ! $is_block_theme;

/*
* For block themes, print stored styles in the header.
* For classic themes, in the footer.
*/
if (
( $is_block_theme && doing_action( 'wp_footer' ) ) ||
( $is_classic_theme && doing_action( 'wp_enqueue_scripts' ) )
) {
return;
}

$core_styles_keys = array( 'block-supports' );
$compiled_core_stylesheet = '';
$style_tag_id = 'core';
Expand Down

0 comments on commit 13785f1

Please sign in to comment.