wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren
wp_enqueue_global_styles › WordPress Function
Seit5.8.0
Veraltetn/v
› wp_enqueue_global_styles ( Keine Parameter )
Definiert in: |
|
Codex: |
Enqueues the global styles defined via theme.json.
Ähnliche Funktionen: wp_enqueue_block_style, wp_get_global_styles, wp_enqueue_style, wp_get_global_stylesheet, wp_dequeue_style
Quellcode
function wp_enqueue_global_styles() { $separate_assets = wp_should_load_separate_core_block_assets(); $is_block_theme = wp_is_block_theme(); $is_classic_theme = ! $is_block_theme; /* * Global styles should be printed in the head when loading all styles combined. * The footer should only be used to print global styles for classic themes with separate core assets enabled. * * See https://core.trac.wordpress.org/ticket/53494. */ if ( ( $is_block_theme && doing_action( 'wp_footer' ) ) || ( $is_classic_theme && doing_action( 'wp_footer' ) && ! $separate_assets ) || ( $is_classic_theme && doing_action( 'wp_enqueue_scripts' ) && $separate_assets ) ) { return; } $stylesheet = wp_get_global_stylesheet(); if ( empty( $stylesheet ) ) { return; } wp_register_style( 'global-styles', false, array(), true, true ); wp_add_inline_style( 'global-styles', $stylesheet ); wp_enqueue_style( 'global-styles' ); }