-
-
Save hofmannsven/e5a2e6299e5d03ad5c23 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// add ie conditional html5 shim to header | |
function _s_add_ie_html5_shim () { | |
echo '<!--[if lt IE 9]>'; | |
echo '<script src="' . get_template_directory_uri() . '/js/html5.js"></script>'; | |
echo '<![endif]-->'; | |
} | |
add_action('wp_head', '_s_add_ie_html5_shim'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Enqueue scripts and styles. | |
*/ | |
function _s_scripts() { | |
wp_enqueue_script( '_s-html5shiv', get_template_directory_uri() . '/js/html5shiv.js', array(), '3.7.2', true ); | |
} | |
add_action( 'wp_enqueue_scripts', '_s_scripts' ); | |
/** | |
* Load only in IE as of WP 4.1 | |
*/ | |
function _s_html5shiv( $tag, $handle, $src ) { | |
if ( '_s-html5shiv' === $handle ) { | |
$tag = "<!--[if lt IE 9]>\n"; | |
$tag .= "<script type='text/javascript' src='$src'></script>\n"; | |
$tag .= "<![endif]-->\n"; | |
} | |
return $tag; | |
} | |
add_filter( 'script_loader_tag', '_s_html5shiv', 10, 3 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment