In a WordPress theme, how do you conditionally include scripts for ie8 and below? This is primarily to apply polyfills for various html5/css3 features. I see that wp has the $is
wp_register_script() whenever you add scripts to your WP themes or plugins.For IE, conditional tags work very well. Here's how you can add conditional tags into a script, example is for HTML5shiv:
global $wp_scripts;
wp_register_script(
'html5shiv',
get_bloginfo('template_url').'/assets/js/html5shiv.js',
array(),
'3.6.2'
);
$wp_scripts->add_data( 'html5shiv', 'conditional', 'lt IE 9' );