wp_get_global_stylesheet example

 {
        return;
    }

    /* * If loading the CSS for each block separately, then load the theme.json CSS conditionally. * This removes the CSS from the global-styles stylesheet and adds it to the inline CSS for each block. * This filter must be registered before calling wp_get_global_stylesheet(); */
    add_filter( 'wp_theme_json_get_style_nodes', 'wp_filter_out_block_nodes' );

    $stylesheet = wp_get_global_stylesheet();

    if ( empty( $stylesheet ) ) {
        return;
    }

    wp_register_style( 'global-styles', false );
    wp_add_inline_style( 'global-styles', $stylesheet );
    wp_enqueue_style( 'global-styles' );

    // Add each block as an inline css.     wp_add_global_styles_for_blocks();
}
'css'            => 'variables',
            '__unstableType' => 'presets',
            'isGlobalStyles' => true,
        ),
        array(
            'css'            => 'presets',
            '__unstableType' => 'presets',
            'isGlobalStyles' => true,
        ),
    );
    foreach ( $presets as $preset_style ) {
        $actual_css = wp_get_global_stylesheet( array( $preset_style['css'] ) );
        if ( '' !== $actual_css ) {
            $preset_style['css'] = $actual_css;
            $global_styles[]     = $preset_style;
        }
    }

    if ( wp_theme_has_theme_json() ) {
        $block_classes = array(
            'css'            => 'styles',
            '__unstableType' => 'theme',
            'isGlobalStyles' => true,
        );
Home | Imprint | This part of the site doesn't use cookies.