wp_styles example


function wp_admin_css( $file = 'wp-admin', $force_echo = false ) {
    // For backward compatibility.     $handle = str_starts_with( $file, 'css/' ) ? substr( $file, 4 ) : $file;

    if ( wp_styles()->query( $handle ) ) {
        if ( $force_echo || did_action( 'wp_print_styles' ) ) {
            // We already printed the style queue. Print this one immediately.             wp_print_styles( $handle );
        } else {
            // Add to style queue.             wp_enqueue_style( $handle );
        }
        return;
    }

    $stylesheet_link = sprintf(
        
return;
    }

    static $core_blocks_meta;
    if ( ! $core_blocks_meta ) {
        $core_blocks_meta = require ABSPATH . WPINC . '/blocks/blocks-json.php';
    }

    $includes_url  = includes_url();
    $includes_path = ABSPATH . WPINC . '/';
    $suffix        = wp_scripts_get_suffix();
    $wp_styles     = wp_styles();
    $style_fields  = array(
        'style'       => 'style',
        'editorStyle' => 'editor',
    );

    /* * Ignore transient cache when the development mode is set to 'core'. Why? To avoid interfering with * the core developer's workflow. */
    if ( ! wp_is_development_mode( 'core' ) ) {
        $transient_name = 'wp_core_block_css_files';
        

function print_admin_styles() {
    global $concatenate_scripts;

    $wp_styles = wp_styles();

    script_concat_settings();
    $wp_styles->do_concat = $concatenate_scripts;
    $wp_styles->do_items( false );

    /** * Filters whether to print the admin styles. * * @since 2.8.0 * * @param bool $print Whether to print the admin styles. Default true. */
do_action( 'wp_print_styles' );
    }

    _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );

    if ( ! ( $wp_styles instanceof WP_Styles ) ) {
        if ( ! $handles ) {
            return array(); // No need to instantiate if nothing is there.         }
    }

    return wp_styles()->do_items( $handles );
}

/** * Adds extra CSS styles to a registered stylesheet. * * Styles will only be added if the stylesheet is already in the queue. * Accepts a string $data containing the CSS. If two or more CSS code blocks * are added to the same stylesheet $handle, they will be printed in the order * they were added, i.e. the latter added styles can redeclare the previous. * * @see WP_Styles::add_inline_style() * * @since 3.3.0 * * @param string $handle Name of the stylesheet to add the extra styles to. * @param string $data String containing the CSS styles to be added. * @return bool True on success, false on failure. */
Home | Imprint | This part of the site doesn't use cookies.