How to write a Wordpress plugin: episode 1 - getting started
Wordpress plugins are the single best way of integrating new functionality into a Wordpress install. You write the plugin, upload it to your site and activate it. If you grow tired of it, you de-activate it - it really is that simple. There are hundreds of great plugins already available but it's always handy to know how to write one yourself, so here we go.
Episode 1: Making a very simple plugin and getting it recognised
The first step is to actually create your plugin and get it recognised within Wordpress before trying to include any functionality. So in this episode we're going to create a very basic plugin that doesn't actually do anything and install it.
#1 - Headers are important
Wordpress needs quite a strict setup in the head of the PHP file to identify the attributes of your plugin, so I'll show you how mine looks: "Plugin Name", "Author" and "Description" are rather self explanatory. "Plugin URI" is a direct link to the project page for this plugin, where users can visit for updates, support etc. The version is a number you wish to assign to the release, so version it however you like. "Author URI" is your website. In this instance the "Author URI" and "Plugin URI" are the same because this is only a demonstration plugin rather than a dedicated project.
#2 - Plugin content
I then wrote a function to initialise the plugin, this is called later to write some content onto the specific plugin configuration page (under "Options", where you see all the other plugin config pages). All this function does at the moment is return some HTML as a token gesture to show that we've actually got something working. The "wrap" div is significant because that is a Wordpress wide constant, placing all your content into a suitably styled container.