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 WordPress Theme Development Working with CSS and JS in WordPress Themes How to Link to JS from functions.php File

Diego Villaseñor
Diego Villaseñor
12,615 Points

NoConflict jQuery and Foundation

If I´m wroking with foundation, do I have to add the noconflict wrapper to each foundation javascript file, like foundation.js and foundation.topbar.js?

2 Answers

Jacobus Hindson
Jacobus Hindson
14,429 Points

Hi Diego,

No you don't have to change the js files yourself but merely enqueue them with the 'jquery' dependency in your functions.php file.

wp_enqueue_script( 'bootstrap_js', get_template_directory_uri() . '/js/bootstrap.min.js', array('jquery'), '', true);

The snippet above is enqueueing my script for bootstrap.min.js, First i give it a unique identifier, then tell it where it is, and then the dependency and where to load it.

The Codex gives a full run down or Check out the WordPress Theme Dev Course by Zac Gordon here.