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

Tim Bauer
Tim Bauer
1,020 Points

The jquery noconflict bit no longer seems to live on the wordpress.org page referenced in the video. Just fyi

I'm not sure if this is an issue or not. I'm going to just hand type in the code shown in the video. It is somewhat disconcerting, though, that this page that seems fundamental to the theme design no longer seems to exist.

4 Answers

For anyone else that is looking for the snippet, here it is:

jQuery(document).ready(function($) {
    // code here
    $( ".nav-toggle" ).click(function() {
      $(this).toggleClass("open");
      $("nav").fadeToggle(100);

      return false;
    });

});

It still seems to work fine even though it has been removed from the codex. Alternatively, this page offers a different method with similar results:

(function( $ ) {
    "use strict";
    $(function() {
        // code here
        $( ".nav-toggle" ).click(function() {
          $(this).toggleClass("open");
          $("nav").fadeToggle(100);

          return false;
        });
    });
}(jQuery));
Jake Flaten
Jake Flaten
5,910 Points

I noticed this as well. I wonder if perhaps one of the later versions of Wordpress has the noConflict wrapper included automatically in the core files? so that rather than us having to tell it to translate in the theme file, WP just knows to look out for it? I'm not sure.