Writing your own WordPress plugin is not that difficult if you are a web developer with basic PHP skills. The only thing you will need, coupled with your PHP skills, is some direction, some resources, a little information on how WordPress expects your plugin to behave and, most importantly, a great idea.
If you are a newbie, don’t be put off or daunted by all the code, ultimately a plugin is only program, a set of functions, that adds a specific set of features and services that can be executed in different sections of your WordPress site.
This article covers WordPress Plugin Development, from tutorials, useful resources, how-tos, guides and some cheat sheets.
Writing a Plugin – WordPress Codex »
The best way to learn anything new is to start at the source. In this case, the WordPress Codex, while sometimes being vague, is an invaluable resource.
The most obvious and most important development section part of any new plugins development are the headers, the licence and then, how to programme your plugin.
WP Plugin Information Header
The top of your Plugin's main PHP file must contain a standard Plugin information header. This header lets WordPress recognize that your Plugin exists, adds it to the Plugin management screen so it can be activated, load it, and run its functions. This is the code:
Following the header it is now time for the licence, which is optional, you don't have to do it. It is good practice to do so, though. Here is the code:
Filter and Action Hooks and Template Tags
Plugins function simply by connecting to one or more "hooks", they could be either "filter" or "action" hooks, and work by modifying the default behavior of WordPress.
Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. View the Wordpess Action Hook List here: WP Actions Reference »
Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. View the WordPress Filter Hook List here: WP Filter Reference »
Another way to add functionality to a plugin is by creating custom Template Tags. Someone who wants to use your Plugin can add these "tags" to their theme, in the sidebar, post content section, or wherever it is appropriate.
For a detailed look at WP template tags click here: Template Tags List »
WordPress Hooks Database »
If you're a plugin developer, you will know how difficult it can be to figure out which hooks are available. This WordPress hooks database automatically scans each WP build for apply_filters(), do_action(), and do_action_ref_array to figure out exactly which hooks are available in each version and where the hooks occur. An invaluable resource.
You can filter the hooks by version and view new hooks, as well as viewing deleted hooks.
This video tutorial, from WordPress TV, demonstrates the basics of constructing a plugin, designing it to make the changes you want, and then using that plugin to alter your WordPress site in a persistent way. Includes some basic discussion on hooks and functions, as well as some sample code.
A small and basic tutorial on how to develop a WordPress plugin.
Dashboard Widgets »
A widget is a PHP function that echoes string data to STDOUT when called. To turn such a PHP function into a WordPress Widget it must be registered as such. This is done using a PHP callback (a Pseudo-Type in PHP documentation) that is registered by a wordpress widget API function.
With the release of WordPress 2.7 a new Dashboard Widgets API was introduced that makes it very simple to add new widgets to the administration dashboard. Doing so requires working knowledge of PHP and the WordPress Plugin API, but to plugin or theme authors familiar with hooking actions and filters it only takes a few minutes and can be a great way to make your plugin even more useful.
This detailed guide gives you a comprehensive look at how to create and implement the always useful WP widgets.
This resource contains the technical documentation of the WordPress Widgets API: Widgets API »
This step-by-step tutorial explains how to create a WordPress widget from scratch. You will make widget using PHP5 OOP. You will also learn how to implement a configuration page for your widget.
How to Write a WordPress Plugin – Devlounge »
Wheras the the above plugin overview and tutorial will help you with the basics and help you with your first steps within plugin development, this extensive tutorial by Ronald Huereca, will get your hands dirty and guide you towards developing a powerful and multi functional plugin. This tutorial is for the advanced user.
How to Write a WordPress Plugin is an extensive and indepth, twelve entry series on the process of creating your own WordPress plugin. Every step is covered, from “Seven Steps for Writing a WordPress Plugin” all the way down to adding ajax to your plugin and releasing it.
Table of Contents: How to Write a WordPress Plugin
1. How to Write a WordPress Plugin – Introduction »
2. Seven Reasons to Write a WordPress Plugin »
3. How to Get Ideas for WordPress Plugins »
4. Structure of a WordPress Plugin »
5. WordPress Plugin Actions »
6. WordPress Plugin Filters »
7. Constructing a WordPress Plugin Admin Panel »
8. Constructing a WordPress Plugin User’s Panel »
9. WordPress Plugins and Database Interaction »
11. Using AJAX with your WordPress Plugin »
12. Releasing and Promoting Your WordPress Plugin »
You can also download the full tutorial in PDF format here:.
Anatomy of a WordPress Plugin »
This tuorial covers information on how WordPress expects your plugin to behave.
WordPress is well known for its amazing collection of free plugins. There is one for almost every need you can think of, from backing up your WordPress installation to asking for a cup of coffee or fighting spam.
But there are times when none of the available plugins seem to quite do the trick you are looking for. To help you in moments like that, this tutorial will guide you through every step of building a simple, widgetized WordPress plugin with settings.
Despite an extensive codex, many WordPress users remain unfamiliar with how to create their own custom plugins. In this video,you'll start from scratch and build your first usable plugin. For this example, you'll write a simple "tuts formatting" function that allows a blog editor to easily format articles.
Download the source files here: .
First WP Plugin in 20 Lines »
This tutorial is for newbie plugin developers, it doesn’t explain how to use WP nor how to code PHP. What it does do is create a plugin in only 20 lines, which is pretty cool. You will create a plugin called "Hello World" and its function will be to simply add some HTML to a pages footer or a post.
Create a Custom WordPress Plugin From Scratch »
This extensive tutorial from Net Tuts will teach you how to create a WordPress plugin that extracts and displays products from an external OSCommerce shop database. It will show you the file structure of a plugin and where it will be included in the WordPress structure, then how to make theplugin visible for WordPress and integrating it with actions run by its frame. Next, creating the configuration panel and then how to implemen the front-end functions themselves that will interact with the OSCommerce database and extract the required data.
Finally, you'll be modifying the default template to display the extracted data in the sidebar.
In this tutorial you will learn how to create a social bookmark plugin that when activated can be easily inserted into WP posts.
Most of the bloggers do not want all of the bookmark buttons to appear after their posts, so, you will learn how to remove any of the buttons listed within the plugin or it shows you how to easily add a new ones. If you are also reasonably comfortable with PHP, you will learn how to customize the social bookmarks lists included in the plugin source.
When you first look at the code behind WordPress plugins, it can look quite daunting: It is full of API interaction, and to understand what was going on required jumping between files and tracing through various function calls.
Your initial scepticism can be quickly overcome, as the authors says, you will soon learn that you do not really need to understand everything that goes on.
This easy to read tutorial and guide takes you through the full process, and I mean full process, of developing a plugin. Not much is missed at all.
Markku Seguerra’s slides from a WordCamp Phillipines 2008 presentation on plugin development.
How to write a WordPress Twitter Widget
How to write a WordPress Twitter Widget »
There are plenty of WordPress Twitter widgets, some better than others, but why not start and write your own? In this three part tutorial you’ll how to put together the basic code for creating your own personalized Twitter sidebar widget.
You will start with the usual widget code, then learn how to send a call off to Twitter with your username and password, ask Twitter for a certain number of Tweets and finally learn how to display these Tweets in a widget.
Simplified AJAX For WordPress Plugin Developers using Jquery »
This tut assumes that you know how to write a WP plugin, and now you are wondering how to use ajax to add that sexy feature which will make your plugin look bit cool.
The author uses his own plugin as a guide to how he implemented Ajax within the plugin, and describes in detail how this was achieved.
Design And Style Your WordPress Plugin Admin Panel »
The great thing about WordPress is that it's highly customizable and flexible. Within a WordPress plugin, almost all of the fields could be change to your desire results. When you are building a WordPress Plugin, chances are there is a need for you to create some admin pages for the users to customize the setting they want.
WordPress admin default has their own CSS style and you can make use of it for your WordPress Plugin Admin Panel if you require one. If you require additional styling for your admin panel, you can also link in an external CSS stylesheet within your plugin.
This cheat sheet for the WordPress plugin API, has been designed to be used as a desktop background. It’s 1280×1024 pixels, and in PNG format.