Enqueue jQuery in WordPress

One of the most common problems that plagues professional theme, plugin, and application developers in WordPress is when libraries such as jQuery are improperly dequeued, deregistered, or simply moved to load else where in the page.

Not only can this drastically impact the site on which the code is running, it can adversely affect the performance of every other well-coded plugin or theme that a user may eventually use.

So in my latest article on WPTuts+, I attempt to provide a beginner’s to for how to enqueue jQuery in WordPress.

Enqueue jQuery in WordPress Properly

Enqueue jQuery in WordPress

In short, the article attempts to provide the rationale and reasoning along with practical steps for how to properly enqueue jQuery in WordPress as well as the reasons why it’s problematic to do it any other way.

Specifically, the article covers the following topics:

  • A Word About Including JavaScript Files
  • Thinking of WordPress as a Foundation
  • Why The Problem of JavaScript Conflicts Exist
  • How To Properly Include jQuery

Ultimately, the purpose of the article to continue evangelizing best practices to prevent plugins from breaking other plugins, themes, and things built on top of WordPress.

For those who are interested, Edward Cassie, Eric Mann, and myself have actually been talking a little bit about jQuery and how to properly scope it on Twitter at the time that this post was written.

We’ve a long way to go, but hopefully we can keep spreading the good word.

Comments on this post are closed. Let's keep the discussion on original post!

Category:
Articles
Tags: