Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Adding a script in WordPress, with IE conditional.
add_action( 'wp_enqueue_scripts', 'cs_conditional_scripts_and_styles' );
* Enqueue styles and scripts conditionally.
* @link
* @since 1.0.0
function cs_conditional_scripts_and_styles() {
* Enqueue flexiility.js script for users of IE9 and below.
* @link:
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
You can’t perform that action at this time.