Using jQueryUI in WordPress

With the update to WordPress 3.3.x, the WordPress core now includes the entire jQueryUI suite packaged in the download. No longer do plugin and theme developers have to include their own custom builds of jQueryUI elements (hopefully they never did include custom builds of the elements, but there are quite a few plugins and themes that did). Instead, you simply need to enqueue the existing scripts.

Following is a full list of the jQueryUI elements included in WordPress, along with their “handles” for use with the wp_enqueue_script() function.

Using Javascript in WordPress Themes

If you’re planning to use javascript on your WordPress blog or website, there is one function with which you should become intimately familiar. That function is wp_enqueue_script(). It will also be helpful if you do a little bit of research into the wp_deregister_script() function, though, the only official information you’ll find about that function is in the codex information about the wp_enqueue_script() function.

Basically, this function keeps a log of all of the javascript files and libraries you want to use in your theme, makes sure you aren’t duplicating any, and then outputs them in the right order. I would recommend setting the $in_footer parameter to boolean true for all of the scripts you enqueue, as that causes WordPress to add the javascript calls to the footer of your pages rather than putting them in the header. In order to do this, though, you need to make sure that you include the wp_footer() function inside of your theme (preferably just above the closing </body> tag).