Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Switch from wp_enqueue_style to just outputting the style tags in o…
…rder to get the output in the correct place after the customizer css
  • Loading branch information
glendaviesnz committed Jan 25, 2023
commit f67ba8c9b65f803a5b6acef3d99c6ab65ed55d1c
8 changes: 5 additions & 3 deletions lib/compat/wordpress-6.1/script-loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ function gutenberg_enqueue_global_styles_custom_css() {
$custom_css = get_global_styles_custom_css();
$is_block_theme = wp_is_block_theme();
if ( $custom_css && $is_block_theme ) {
wp_register_style( 'global-styles-custom-css', false, array(), true, true );
wp_add_inline_style( 'global-styles-custom-css', $custom_css );
wp_enqueue_style( 'global-styles-custom-css' );
?>
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Outputting the style element here, instead of using wp_enqueue_style was the only way I could get this to load in the header after the customizer custom CSS - there may be a better approach that I am overlooking

<style id="global-styles-custom-css-inline-css" type="text/css">
<?php echo $custom_css; ?>
</style>
<?php
}
}

Expand Down