Last active
August 25, 2018 11:50
-
-
Save GaryJones/1960257 to your computer and use it in GitHub Desktop.
Enqueue any style sheet with a conditional comment (usually for IE)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', 'prefix_add_ie8_style_sheet', 200 ); | |
/** | |
* Enqueue an IE-specific style sheet. | |
* | |
* Add a style sheet for everyone, then mark it as conditional to IE8 or below. | |
* | |
* @author Gary Jones | |
* @link https://garyjones.io/enqueued-style-sheet-extras#ie | |
*/ | |
function prefix_add_ie8_style_sheet() { | |
global $wp_styles; | |
wp_enqueue_style( 'child-ie8', get_stylesheet_directory_uri() . '/style-ie8.css', [], '1.0.0' ); | |
$wp_styles->add_data( 'child-ie8', 'conditional', 'lte IE 8' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment