You’re probably here because you got the jQuery error “Uncaught ReferenceError: Velocity is not defined” after implementing Materialize into your WordPress site.
The Good news is this is a simple fix so you can get right back to it! 🙂
The issue is that WordPress defines jQuery in no conflict ( jQuery ) and Materialize defines jQuery with the dollar sign ( $ ) so when materialize.min.js is loaded you’ll need to change out a line of code in the file to get it working correctly with your WordPress site.
Once you’ve added the materialize.min.js file to your site, open it up in a text editor or whatever FTP editor you use and do a search for this code
Vel=$?$.Velocity:Velocity
and replace it with this code
Vel=jQuery?jQuery.Velocity:Velocity
Once you do this, you should be all set!
Hi Jordan, good fix but, unfortunatly, it doesn’t work for me 🙁
I’m building a WordPress plugin styled with materialize that works on the edit post pages in the backend: if I try your fix the error with velocity disappears but instead i’ve got this error
Uncaught Error: Method value does not exist on jQuery.tooltip
Have you any idea to fix this?
Thanks and sorry for my english 🙂
Stefano
Hey Stefano, thanks for reaching out. Not quite sure. I would just recommend reducing things to the simplest level. Does the tooltip functionality work without Materialize enqueued? The new error might not necessarily be connected to materialize either.
Hi Jordan thanks for the quick response 🙂 I continue to search and I’ve found that the problem is generate by Iris color picker: for some reason if I remove it, Materialize works normally.
Awesome Man! Glad you figured it out! Have a good one!