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 trial

WordPress

Stephen Prado
Stephen Prado
821 Points

Linking the flexslider to Wordpress

Hi,

I can't seem to link the flexslider to Wordpress. Keep getting this error message: TypeError: 'undefined' is not a function (evaluating '$('.flexslider').flexslider()')

After copying and using the exact same files and info from "How to build a Wordpress theme - Linking Javascript" It still does link it.

Anyone els having the same problem?

6 Answers

Richard Feinburg
Richard Feinburg
2,970 Points

Dont know. Can you provide the full HTML page.

Richard Feinburg
Richard Feinburg
2,970 Points

Is your javascript link correct to your html? Can you provide a link to the WordPress page to check it out?

Stephen Prado
Stephen Prado
821 Points

It's on a local server unfortunately. The javascript link is copied straight from the the project file: functions.php and the flexslider.js is also correctly placed. weird

Richard Feinburg
Richard Feinburg
2,970 Points

Use "Firebug" to make sure you don't have any javascript errors!

Mainly two reasons for this error.

Either you have not included the required plugin. You have included jQuery twice. You are doing the second thing i.e. including jQuery twice.

Stephen Prado
Stephen Prado
821 Points

Thank you for taking the time to answer.

What was the required plugin?

Adam Soucie
PLUS
Adam Soucie
Courses Plus Student 8,710 Points

Make sure you don't have two Javascript enqueues using the same name. I make that mistake all the time, especially when I do a quick copy/paste. I'll change everything, and forget to update the script name.