Many of us use styles to alter the look of our website, and scripts to enhance functionality. It is important to note however, that the way you add these scripts to WordPress is just as important as the content of these files. Instead of plopping them into the header or footer file we need to use WordPress’ enqueue functionality.

In this article, I’ll show you how to add scripts and styles to your themes and plugins, whether you are creating something on the front-end or in the backend.

We’ll cover:

What is Enqueueing?

Enqueueing is a CMS-friendly way of adding scripts and styles to WordPress websites. Multiple plugins you have may use jQuery and other shared scripts. If each plugin linked to these assets separately, chaos would ensue and all your JavaScript could stop working.

By enqueueing scripts you are telling WordPress about the assets you want to add and it will take care of actually linking to them in the header and footer. You can even specify the dependencies of your scripts and styles and WordPress will add them in the correct order.

It takes all the information from what is needed by the core, by your theme and your plugins, creates a list of scripts and styles needed, and outputs them in the correct location.

Enqueuing: The Bottom Line

No matter how you attach your assets, the end result will be a