I am using the complete version offered at http://foundation.zurb.com/sites/download.html/ in my WordPress theme WP-Forge and I am still getting JS errors in Google dev tools console.
Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_1__home_deployer_sites_node_foundation_customizer_node_foundation_customizer_foundation_sites_js_foundation_core__.a.addToJQuery is not a function
at Object.<anonymous> (foundation.js?ver=6.4:11621)
at __webpack_require__ (foundation.js?ver=6.4:20)
at module.exports (foundation.js?ver=6.4:66)
at foundation.js?ver=6.4:69
Also in theme-functions.js I have the following:
`jQuery(document).foundation();'
and Google dev tools is throwing the following error:
Uncaught TypeError: jQuery(...).foundation is not a function
at theme-functions.js?ver=6.4:2
Even if I change it to this:
$(document).foundation();
I still get the following error:
Uncaught TypeError: $ is not a function
at theme-functions.js?ver=6.4:2
This used to work before I added the new files from 6.4. - WordPress ships with its own version of jQuery and it is in no-conflict mode:
WordPress comes pre-packaged with a copy of jQuery, which you should use with your code. When WordPress’ jQuery is loaded, it uses compatibility mode, which is a mechanism for avoiding conflicts with other language libraries.
What this boils down to is that you can’t use the dollar sign directly as you would in other projects. When writing jQuery for WordPress you need to use jQuery instead.
Any thoughts or ideas?
@tsquez I believe the external declarations as they are today may assume access to $... we can almost certainly resolve this, but to check can you try running window.$ = window.jQuery in a script just before you include the foundation js?
Actually, looking once again at our config I wouldn't expect that to be a problem. Hmm... To track this down, previously you were testing against the build from the dist folder in the package... can you see if that JS works for you? I'm wondering if there's something going on with the way the customizer is generating the js...
@kball - OK I used the js from the rc4 dist folder I had and everything works now and there are no errors in GDT.
Interesting... ok, so it sounds like the customizer JS isn't working in your case... digging into it
sounds good, but actually let me do this. I am going to download the github files and see if that js file works. I normally don't download the complete.zip - I usually use the distro from the repo. let me do that real quick and see what happens.
Found it! Fixing
YOU DAH MAN!!!
Yeah I downloaded the latest version from here and used the files from the distro folder and everything works great. Glad you able to narrow it down. I am going to close this.
Customizer fixed. Thanks again for the report and helping track this down quickly @tsquez!
Anytime amigo