Make WordPress Core


Ignore:
Timestamp:
07/25/2011 12:36:06 AM (12 years ago)
Author:
azaozz
Message:

Use json_encode() for adding script data (formerly l10n). Add the same functionality to WP_Styles for adding inline css after a stylesheet has been outputted. See #11520

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/functions.wp-styles.php

    r15601 r18464  
    2626    if ( !is_a($wp_styles, 'WP_Styles') ) {
    2727        if ( !$handles )
    28             return array(); // No need to instantiate if nothing's there.
     28            return array(); // No need to instantiate if nothing is there.
    2929        else
    3030            $wp_styles = new WP_Styles();
     
    3232
    3333    return $wp_styles->do_items( $handles );
     34}
     35
     36/**
     37 * Adds extra CSS.
     38 *
     39 * Works only if the stylesheet has already been added.
     40 * Accepts a string $data containing the CSS.
     41 *
     42 * @since 3.3
     43 * @see WP_Scripts::add_inline_style()
     44 */
     45function wp_add_inline_style( $handle, $data ) {
     46    global $wp_styles;
     47    if ( !is_a($wp_styles, 'WP_Styles') )
     48        return false;
     49
     50    return $wp_styles->add_inline_style( $handle, $data );
    3451}
    3552
Note: See TracChangeset for help on using the changeset viewer.