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 trialTim Bauer
1,020 PointsThe 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
Aarief Ahmad Haafiz
1,251 PointsFor 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));
roberthopman
16,502 PointsJake Flaten
5,910 PointsI 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.
Glenré Charl Labuschagné
23,204 PointsHi all, jQuery has it's own page for this, see following links: https://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/ and more specifically for the code snippet used in the video: https://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/#use-the-argument-that-39-s-passed-to-the-jquery-document-ready-function.
Hugues Audouard
1,508 PointsHugues Audouard
1,508 PointsThank you :-)
Dominic Davies
5,284 PointsDominic Davies
5,284 PointsThanks!