Wordpress

From Metro Studios Knowledgebase

Jump to: navigation, search

[edit] Functions.php Resources


[edit] Common Problems

$ is not a function (see #5 http://www.ericmmartin.com/5-tips-for-using-jquery-with-wordpress/)

"All of the previous steps are nullified if proper jQuery coding conventions aren't followed. The most common issue I see with jQuery and WordPress is the misuse of the $ variable.

It is important to know that the version of jQuery that comes with WordPress automatically calls the jQuery.noConflict(); function, which gives control of the $ variable back to whichever library first implemented it. If you are loading a different copy of jQuery, you'll need to manually call jQuery.noConflict();, if necessary, from one of your JavaScript files.

As a general rule, you should not use the $ variable for jQuery unless you have used one of the shortcuts. The following is an example of how to shortcut jQuery to safely use the $ variable:

Personal tools
Namespaces
Variants
Actions
Wiki Navigation
Knowledgebase
Toolbox