Disabling jQuery from the Google CDN creates TypeError: Property '$'

Inside config.php there is an option to disable loading jQuery from the Google CDN. If this is done, developer tools catches an error inside scripts.min.js

Uncaught TypeError: Property '$' of object [object Object] is not a function 

The reason for not using Google CDN is that I need to fully support the jQuery included with WordPress.

I’ve tested this on the latest version of Roots (6.5.1) and the latest install of WordPress (3.7.1). Fresh installs, no plugins.

Is this a bug or is there something I need to do in addition to commenting out:

//add_theme_support('jquery-cdn');

… inside config.php

Ahh, that’s because WordPress uses jQuery in noConflict mode. You’d have to edit _main.js to replace $ with jQuery. We should probably fix this in the repo…

edit:

ps. the WordPress jQuery version is the same as the one we load from the Google CDN. What do you mean by you need to fully support the included jQuery? You shouldn’t run into conflicts

To be more specific, update the last line in _main.js to be jQuery(document).ready(UTIL.loadEvents); and then change the $.each in that file to jQuery.each

Thanks Ben. We are using Roots as a boilerplate for theme development and the market place (Envato) has a strict policy not to use deregister to load anything other than the default version of jQuery.

Authors are not allowed to deregister the default version of jQuery and load another one.

There are arguments on both sites of this policy but for now we need to follow the guidelines or our theme will not be accepted. I’m sure other theme authors are doing the same thing - disabling jquery-cdn, even though it’s good coding.

Thanks for looking into that.

Here is the reference to the policy in case you are interested.

Envato Policy RE: deregister default version of jQuery

This is an important issue. The version of jquery loaded via roots is fixed so if that changes in WP it doesn’t mean it changes in all the roots based themes we have built. Disabling theme support in config is a good feature but the whole structure of _main.js should really be changed to no conflict mode. I have read about changing the wrapper to allow for normal jquery to be run in no conflict mode but I have not been able to get it work correctly. Does anyone have a solution where we can still use the _main.js wrapper but in no conflict mode?

And now I see this has already been handle in the latest update. Please ignore.