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
Try to use the wp_style_add_data()
function (officially used in twentythirteen and twentyfourteen theme:
wp_enqueue_style( 'iepolyfill', bloginfo( 'stylesheet_directory' ) . '/js/iepolyfill.min.js' );
wp_style_add_data( 'iepolyfill', 'conditional', 'if lt IE 9' );
Update: Since WordPress >= 4.2.0 there is a function that is used in the same way. It's called:
wp_script_add_data()