Michael Silverman documenting innovation at work

14Nov/113

How to Create a WordPress Plugin

Mike Example Plugin admin page.

Before creating a plugin it's helpful to determine the tools you need for your plugin to function and then determine how to integrate them into WordPress. In this guide I will be teaching by example. The plugin we will be creating is a simple post text replacement plugin. In the WP Admin panel we will be able to modify the search and replace parameters. We also will have a replacement color and toggle color. After some planning I've determined this plugin will require the following:

  1. jQuery : We need jQuery to toggle the class on our replacement text when clicked.
  2. Database : We need our settings stored permanently. Of course you already have a database set up for WordPress. We will use that.
  3. CSS : We will use two stylesheets, one for the admin side and one for the client side.
  4. Custom Javascript: We're going to place our code in a separate file to show you how to load JavaScript on the admin side and the client side.

As mentioned before we want the plugin to have an admin panel accessible from the WordPress panel. We also need to hook into posts/pages for our search matching.
The following are WordPress documents that are essential for reference when creating a plugin. It will prove useful to have them bookmarked and opened in your browser at all times.