Getting jQuery into WordPress
jQuery can be included into WordPress in three different ways as follows:
You can download it from
jQuery.com
, and include it directly with ascript
tag into your XHTML header tags, inside your theme'sheader.php
file (this method works, but is not really recommended for a variety of reasons)You can register WordPress' bundled jQuery in themes and plugins
You can also take advantage of Google's CDN (Code Distribution Network) to register and include jQuery into your theme and plugins
We covered the basics of the first method in Chapter 1, Getting Started: WordPress and jQuery. WordPress is so flexible that any user with the right admin level can come along and update, enhance the theme, or install additional plugins which may also use a version of jQuery or other JavaScript libraries. Therefore, including jQuery or any JavaScripts directly into the theme with hardcoded script tags is not recommended as it could cause conflicts with other scripts and libraries...