You can do it in two ways….
Solution One:
<?php
add_action( 'wp_head', 'myscript' );
function myscript(){
echo '<!--[if lt IE 9]><script src="https://wordpress.stackexchange.com/questions/138051/your_js_file_path"></script><![endif]-->';
};
?>
Solution Two:
<?php
global $wp_scripts;
wp_register_script( 'jsFileIdentifier', 'YourJsFilePath', array(), '3.6.2' );
$wp_scripts->add_data( 'jsFileIdentifier', 'conditional', 'lt IE 9' );
?>
Related Posts:
- How to en-queue bootstrap 4 to theme?
- Bootstrap js refuses to load
- Check for Twitter Bootstrap Loaded
- wp enqueue inline script due to dependancies
- How to load css in the footer [duplicate]
- How to properly dequeue scripts and styles in child theme?
- How can I enqueue protocol relative external (//ajax.googleapis.com/…) scripts?
- Can’t enqueue scripts in the footer?
- Protocol neutral URLS with wp_enqueue_script (SSL issues)?
- Enqueue script in specific page
- Is it safe/recommended to use wp_enqueue_script function outside the functions.php file?
- wp_enqueue script my_javascript_file in the footer
- Hyphens vs. periods in the script slug in wp_register_script?
- How to load JQuery easing script in wordpress?
- Hook for writing text string after footer scripts
- Is This The Most Efficient Way To Add Javascript Files?
- Why does this line of code make photo albums appear?
- Issue with using Underscore in WordPress
- Enqueue Script with URL parameters
- Track down where script is being enqueued from
- $wp_styles->registered not giving ALL the styles?
- Benefits to enqueuing site scripts/stylesheets?
- Adding Custom Javascript to Skeleton Child Theme
- Problem in wp_localize_script
- Enqueue scripts to a specific header-.php?
- Which are the MediaElement.js scripts to enqueue
- Best way to enqueue extremely popular scripts like bootstrap and font awesome
- How to remove some external js files from source?
- Enqueued scripts and styles loading in WordPress Dashboard as well
- The wp_enqueue_scripts hook doesn’t work at all, not from plugin, not from the template, not for frontend, not for admin pages!
- How can I load script and style in specific page in the back-end?
- Enqueue script with url_query variables?
- wp_enqueue_script with dependencies doesn’t work
- Help with enqueing scripts in footer after init action
- How to properly add Bootstrap and JQuery Javascripts?
- Adding custom fonts (local) to WordPress?
- wp_enqueue_script order – external vs inline js
- What are the advantages of using wp_enqueue_script()
- Modernizr check first, then move on to wp_register_script()/wp_enqueue_script
- Deregister scripts on unnecessary pages using remove_action
- Prioritizing wp enqueue scripts error
- wp_enqueue and Dependencies
- Why are files enqueued with wp_enqueue_style and wp_enqueue_script 404 Not Found?
- Utilizing WordPress’ Admin UI for plugin settings: getting accordion style
- jquery-ui-autocomplete is not loaded with wp_enqueue_script
- wp_enqueue_script Doesn’t Work?
- Getting wp_footer() to work without wp_head()
- wp localizing script not works
- Move scripts to footer, but exclude one script?
- Enqueueing a script and a style sheet not working
- Is there a way to list all the JavaScript scripts that are actually loaded by WordPress? Do we care?
- How to enqueue JavaScript file that depends on CSS stylesheet
- wp_editor() youtube link does not load video
- Enqueue customizer scripts that are bundled by webpack?
- Adding multiple wp_register_scripts for templates in WordPres?
- Localizing script to pass a value to a javascript function
- How do I get jQuery to Load before Bootstrap?
- Conditionally load script depending on current admin page
- Deregister multiple scripts using a function?
- Enqueuing a script before anything else
- Where to insert Google Maps API code in functions.php
- Should I use get_bloginfo(‘stylesheet_directory’) or get_stylesheet_directory_uri() when enqueueing my js files?
- wp_enqueue_script was called incorrectly Issue when active plugins of WordPress Admin Bar Improved
- wp_enqueue_scripts does not work
- How to add conditionals for IE browsers between certain versions?
- call my script only after loading UI library?
- Loading Scripts For Specific Template
- Modular CSS and JS in Child Themes
- All of my Scripts and Enques are getting file not found
- If a Script has been enqueued but not registered can I still removed it?
- include jquery plugin file not working
- why wp_enqueue_scripts() not working?
- How Do I Enqueue a Script into 2 different Footers on the Same Site?
- How to use wp_register_script / wp_enqueue_script for multiple queries
- Enqueue specific script on account creation (and never again)
- scripts not loading
- FullCalendar in WordPress is not working
- Proper enqueue for child theme functions.php
- Wp_deregister_script() doesn’t work
- enqueue_scripts() in child theme doesn’t work
- How do you load js and style resources from CDN with local fallback using wp_enqueue_scripts?
- Issues with wp_enqueue_script and jquery-ui
- loading javascript CDN with local fallback (not jQuery)
- wp_localize_script & wp_enqueue_script not working in front end
- Dynamic wp_enqueue_scripts?
- wordpress enqueue script not working
- Load scripts only for selected template
- WordPress – enqueue js issue – page broken, no error
- Enqueue script with version number not working
- Set a parent script presence status true so that child scripts load in wordpress
- correct path for enqueue script in WordPress
- map enqueue in backend
- Bootstrap navbar responsiveness on WordPress theme menu not working
- How to get, in WP page’s script, a wp enqueued script (in Functions.php)?
- Most optimal way of starting fresh, without using other theme or dropping old files?
- Bootstrap sticky menu in WordPress
- Bootstrap css not getting applied to the custom WordPress Dashboard Widget
- WooCommerce not enqueuing its scripts [closed]
- See Scripts used by Page
- Dequeue/deregister scripts for everybody but the administrator