Skip to content

Instantly share code, notes, and snippets.

@ingozoell
Last active July 4, 2017 09:18
Show Gist options
  • Save ingozoell/d1e2278071696259c3ba154c73558e67 to your computer and use it in GitHub Desktop.
Save ingozoell/d1e2278071696259c3ba154c73558e67 to your computer and use it in GitHub Desktop.
WordPress: Conditional load IE Scripts
function iz_old_ie_scripts() {
if (!is_admin()) {
// Make responsive websites and media queries work in IE8
// wp_register_script( 'respond', ( '//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js' ), FALSE, NULL, FALSE );
// wp_script_add_data( 'respond', 'conditional', 'lt IE 9' );
// Support for :nth-child(n), :last-child, etc in IE8
wp_register_script( 'selectivizr', ( '//cdnjs.cloudflare.com/ajax/libs/selectivizr/1.0.2/selectivizr-min.js' ), array('jquery'), NULL, FALSE );
wp_script_add_data( 'selectivizr', 'conditional', 'lt IE 9' ); }
}
add_action( 'wp_enqueue_scripts', 'iz_old_ie_scripts', 1 );
<!--[if lt IE 9]>
<script src="//cdnjs.cloudflare.com/ajax/libs/respond.js/1.4.2/respond.min.js"></script>
<![endif]-->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment