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 trialAndrew Folts
14,238 PointsI enqueued JQuery UI in Wordpress, but it's not working in functions.js?
When I try and use JQuery UI for something simple like linear easing of an animation, I get an error that says "linear is not defined".
Andrew Folts
14,238 PointsI meant that I enqueued it in functions.php.
But what I try to use it in a anywhere on my site, for example in functions.js as linear easing on an animation, I get the the undefined error.
"linear is undefined".
Andrew Folts
14,238 PointsI enqueued plain jQuery and that works fine, FWI.
2 Answers
Ludvík Matějíček
12,557 PointsI don't know your code in function.php file but if you enqueued scripts which are dependent on jQuery you need add dependency.
example:
wp_enqueue_script( 'custom-script', get_stylesheet_directory_uri() . '/js/custom_script.js', array( 'jquery' ) ); // add array( 'jquery' )
Andrew Folts
14,238 PointsOh, that's what I was doing wrong. Thanks, very much appreciate the help!
Ludvík Matějíček
12,557 PointsNo problem :) i'm glad it helped you.
Jon Goodey
33,092 PointsJon Goodey
33,092 PointsThis should be enqueued in the functions.php file not functions.js is this a typo?