PluginProbe
Gutenberg / 12.6.0
Gutenberg v12.6.0
23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 7.4.0 All 402 releases
gutenberg / lib / compat / wordpress-5.9 / script-loader.php

script-loader.php in Gutenberg 12.6.0, at lib/compat/wordpress-5.9/script-loader.php

35 lines 1003 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Load global styles assets in the front-end.
4 *
5 * @package gutenberg
6 */
7
8 /*
9 * This code lives in script-loader.php
10 * where we just load styles using wp_get_global_stylesheet.
11 */
12 if ( ! function_exists( 'wp_get_global_styles' ) ) {
13 /**
14 * Fetches the preferences for each origin (core, theme, user)
15 * and enqueues the resulting stylesheet.
16 */
17 function gutenberg_enqueue_global_styles_assets() {
18 $stylesheet = wp_get_global_stylesheet();
19 if ( empty( $stylesheet ) ) {
20 return;
21 }
22
23 if ( isset( wp_styles()->registered['global-styles'] ) ) {
24 // We're in WordPress 5.8, so we overwrite the existing.
25 wp_styles()->registered['global-styles']->extra['after'][0] = $stylesheet;
26 } else {
27 // WordPress 5.7 or lower.
28 wp_register_style( 'global-styles', false, array(), true, true );
29 wp_add_inline_style( 'global-styles', $stylesheet );
30 wp_enqueue_style( 'global-styles' );
31 }
32 }
33 add_action( 'wp_enqueue_scripts', 'gutenberg_enqueue_global_styles_assets' );
34 }
35