An Introduction to Asset Handling in WordPress

Originally published at: http://www.sitepoint.com/an-introduction-to-asset-handling-in-wordpress/

As a WordPress theme or plugin developer, there will come a time during your development process that you will need to include third party scripts or stylesheets in your plugin or theme. Sure, simply linking the assets in the header or footer would definitely work, but adhering to standard practice using the provided WordPress API will ensure that your theme or plugin will play nice with other plugins in the WordPress ecosystem.

If you want to provide maximum compatibility with other plugins and themes available, asset handling in WordPress is definitely a skill you should master.

This article is targeted to the beginner WordPress developer, with the assumption that you have a working knowledge of how WordPress action and filter hooks work.

The Basics

WordPress has provided a few basic functions to help the developer correctly load custom assets of their theme or plugin. The four main functions that you will use frequently are wp_register_script, wp_enqueue_script, wp_register_style and wp_enqueue_style.

Let’s go through these four major functions one by one.

Continue reading this article on SitePoint

“This article is targeted to the beginner WordPress developer, with the assumption that you have a working knowledge of how WordPress action and filter hooks work.”

That’s a frustrating line to read for a beginner. I’ve been toying with hooks for quite a while (in Drupal). I still don’t really understand them, because I don’t have a programming background. I get the idea of callbacks and I generally understand the bootstraping concept, but they’re not ‘beginner’ concepts so easily brushed off.

So my comment is this article would be really great if it offered link suggestions for the beginner-beginner articles on these key concepts.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.