Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Carlos Marchena
Carlos Marchena
12,142 Points

New Bootstrap Jumbotron Template Script for IE9

I guess that Jumbotron has changed since the recording of the video because now, just before HTML5 shim and Respond, you can find this:

html<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]--> <script src="../../assets/js/ie-emulation-modes-warning.js"></script>

How would this affect functions.php? Thanks!

2 Answers

Stanley Thijssen
Stanley Thijssen
22,831 Points

You can add a conditional enqueue in your functions.php file for this script that only runs on lt IE 9.

function th_my_scripts() {
    global $wp_scripts;

    wp_register_script( 'ie_reponsive', 'LINK TO UR FILE', '', '', false );

    $wp_scripts->add_data( 'ie_reponsive', 'conditional', 'lt IE 9' );
}
add_action( 'wp_enqueue_scripts', 'th_my_scripts' );
Carlos Marchena
Carlos Marchena
12,142 Points

Thanks! Now, see what I did to replace 'LINK TO UR FILE':

function th_my_scripts() {
    global $wp_scripts;

    wp_register_script( 'ie_reponsive', get_template_directory_uri() . 'js/ie8-responsive-file-warning.js', '', '', false );

    $wp_scripts->add_data( 'ie_reponsive', 'conditional', 'lt IE 9' );
}
add_action( 'wp_enqueue_scripts', 'th_my_scripts' );

You have to create a .js file within your template directory: /js/ie8-responsive-file-warning.js with the code obtained from the following link:

[http://getbootstrap.com/assets/js/ie-emulation-modes-warning.js]

Finally, don't forget to erase this for header.php in order to make it work!

<!--[if lt IE 9]><script src="../../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
    <script src="../../assets/js/ie-emulation-modes-warning.js"></script>