Code template for a WordPress plugin

Hugh Lashbrooke – WordPress-Plugin-Template

I have developed a standard code base from which I start any of my new plugins. I always keep this handy for any new work, so I don’t have to rewrite the same basic code every time I start something new. I’m sure many people have their own similar frameworks for this kind of thing, but I thought it worth sharing my own in case it helps someone else get started with new plugin development. The template includes built-in support for:

Custom post type with custom fields and custom taxonomies
Plugin settings page
WPML i18n

The code is entirely object-oriented and is written according to the WordPress coding standards – all it requires is editing in order to remove the demonstration data and add new, more functional, data. The plugin is obviously not meant to be used in its current form, but if you activate it without changing anything it will create a new post type (identified as ‘*Posts’ in your dashboard menu) and a new settings page (found at Settings > Plugin Settings). These pages are entirely functional, so you can see a working demonstration of how a plugin built using this template will work. You can get the code from GitHub below – feel free to change it to make it more practical for your own use.

Get the code!