Adding a script in WordPress, with IE conditional.
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
add_action( 'wp_enqueue_scripts', 'cs_conditional_scripts_and_styles' ); | |
/** | |
* Enqueue styles and scripts conditionally. | |
* | |
* @link https://msdn.microsoft.com/en-us/library/ms537512(v=vs.85).aspx | |
* @since 1.0.0 | |
*/ | |
function cs_conditional_scripts_and_styles() { | |
/** | |
* Enqueue flexiility.js script for users of IE9 and below. | |
* @link: https://github.com/10up/flexibility | |
*/ | |
wp_enqueue_script( 'flexibility', get_stylesheet_directory_uri() . '/assets/js/flexibility.js', [], '20160502', true ); | |
wp_script_add_data( 'flexibility', 'conditional', 'lte IE 9' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment