Skip to content

Instantly share code, notes, and snippets.

Last active Aug 25, 2018
What would you like to do?
Enqueue any style sheet with a conditional comment (usually for IE)
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
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