Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
/**
* Add styles and scripts to a WordPress site
*
* See https://codex.wordpress.org/Class_Reference/WP_Styles#Conditional_Styles
*/
function my_scripts_styles(){
global $wp_styles;
// Load IE version-specific stylesheets
wp_enqueue_style( 'html5shiv', 'https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js', array(), '3.7.2', 'screen' );
$wp_styles->add_data( 'html5shiv', 'conditional', 'lt IE 9' );
}
add_action('wp_enqueue_scripts', 'my_scripts_styles');
<!-- HTML OUTPUT -->
<!--[if lt IE 9]>
<link rel='stylesheet' id='html5shiv-css' href='https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js?ver=3.7.2' type='text/css' media='screen' />
<![endif]-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment