Introduce wp_style_add_data() as a wrapper for $wp_styles->add_data().

Props obenland, nacin
fixes #18753


git-svn-id: http://core.svn.wordpress.org/trunk@24740 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Ryan Boren 2013-07-18 19:46:38 +00:00
parent 233fa81f13
commit 20d04dfca8
2 changed files with 27 additions and 3 deletions

View File

@ -156,8 +156,6 @@ function twentythirteen_fonts_url() {
* @return void * @return void
*/ */
function twentythirteen_scripts_styles() { function twentythirteen_scripts_styles() {
global $wp_styles;
// Adds JavaScript to pages with the comment form to support sites with // Adds JavaScript to pages with the comment form to support sites with
// threaded comments (when in use). // threaded comments (when in use).
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
@ -181,7 +179,7 @@ function twentythirteen_scripts_styles() {
// Loads the Internet Explorer specific stylesheet. // Loads the Internet Explorer specific stylesheet.
wp_enqueue_style( 'twentythirteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentythirteen-style' ), '2013-07-18' ); wp_enqueue_style( 'twentythirteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentythirteen-style' ), '2013-07-18' );
$wp_styles->add_data( 'twentythirteen-ie', 'conditional', 'lt IE 9' ); wp_style_add_data( 'twentythirteen-ie', 'conditional', 'lt IE 9' );
} }
add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' ); add_action( 'wp_enqueue_scripts', 'twentythirteen_scripts_styles' );

View File

@ -190,3 +190,29 @@ function wp_style_is( $handle, $list = 'enqueued' ) {
return (bool) $wp_styles->query( $handle, $list ); return (bool) $wp_styles->query( $handle, $list );
} }
/**
* Add metadata to CSS style files.
*
* Works only if the stylesheet has already been added.
* Possible values for $key and $value:
*
* conditional string comments for IE 6, lte IE 7 etc.
* rtl bool|string to declare an RTL stylesheet
* suffix string optional suffix, used in combination with RTL
* alt bool for rel="alternate stylesheet"
* title string for preferred/alternate stylesheets
*
* @since 3.6.0
* @see WP_Dependencies::add_data()
*
* @param string $handle Script name.
* @param string $key Name of data point for which we're storing a value.
* Values are 'conditional', 'rtl', and 'suffix', and 'alt', 'title'.
* @param mixed $data
* @return bool True on success, false on failure.
*/
function wp_style_add_data( $handle, $key, $value ) {
global $wp_styles;
return $wp_styles->add_data( $handle, $key, $value );
}