Skip to content

A Complete Guide to Making Your First WordPress Widget

Widgets are a powerful part of WordPress, and they’re a great way to enhance your site’s sidebar. Or your footer. Or your homepage. Or another part of your site that your theme maker thinks would look really good with some widgets.

For the uninitiated, a “widget” is just a WordPress word for a certain type of drag-and-drop build-block area of your site that is made available by a theme. There are tons of different possible widgets, and many built into WordPress. Traditionally, they exist to allow non-developers to easily customize their WordPress site’s sidebar. But at various times, and in various themes, widgets extend far beyond that. Some themes are widget-areas as far as the eye can see, some use widgets in a number of selected and flexible areas, and there are still some old themes you may come across that make no allowances for widgets at all.

A “widget” is just a WordPress word for a certain type of drag-and-drop build-block area of your site that is made available by a theme

We’ll skip the basic tutorial about how you use widgets, because I want to get to the heart of how you make your own. If you’re not familiar though, I’d recommend reading through this page from the WordPress Codex about the basics of the interaction pattern you use with widgets.

Where? Put The Widget In Your Theme? Or a Plugin?

To make your own widget, you’re going to want to use either your theme’s functions.php file, or your own plugin. I’m a big opponent of “theme creep”, but I actually think that widgets straddle that hard-to-call borderland between a presentational-only element that’s fine in a theme, and a bit of completely independent functionality that clearly should be in a plugin.

Yay! 🎉 You made it to the end of the article!
David Hayes
Share:

4 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments
Day 2 of testing my plugin | by Blogger Mom
February 27, 2015 1:52 pm

[…] wpshout.com A Complete Guide to Making Your First WordPress Widget […]

All You Need to Know About Making Widget Areas in WordPress Themes | WPShout.com
November 11, 2014 2:44 pm

[…] user can fiddle with widgets, nor how to make them for yourself (we did cover that one before, with the basics and a guide to user-editable ones). Nope, here we’ll explain how you make areas appear in […]

Creating Dynamic, User-Editable Widgets | WPShout.com
October 21, 2014 4:50 pm

[…] we’re continuing David’s discussion of widgets from a few weeks ago. In his post, David covered how to make a static widget: one that displays, say, a predefined block of images and text, or […]

Mario M
August 8, 2014 5:49 pm

Thanks David, great write up. Will you be publishing any info on further using the form and update methods?

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!