Getting DRY with Starter Plugins for WordPress

Written by Hugh Lashbrooke on September 17, 2014 Blog.

If you’ve ever built a plugin for WordPress, the chances are that you took a while to get the initial code base setup with the necessary plugin headers, class structure and basic instantiations. If you have built more than one plugin then there’s an even better chance that you copied that same code and reused it to start each subsequent one. But what if you had all of that code written before you even start? Wouldn’t that be great? That’s where starter plugins come in.

What is a starter plugin?

A starter plugin (also known as a boilerplate plugin, or a plugin template) is a framework rather than an actual plugin. It is designed to be a code framework that you can use to get started with a new plugin quickly and easily. There are a number of starter plugins available for you to use (more on that in a moment) and some of them come with useful scripts that help you generate a brand new plugin with your own plugin name so you can get going with your unique functionality in no time.

Using a starter plugin is in line with the DRY (don’t repeat yourself) development methodology – the idea is to eliminate the need to reproduce the same code many times over.

Why should I use a starter plugin?

Starter plugins enable you to get going with a new plugin quickly and easily without spending ages writing the same code over and over again. In that case, perhaps a better question is rather “Why shouldn’t I use a starter plugin?” The main concern with using a starter plugin is that you will be duplicating someone else’s code and you may not have a firm grasp of how it works exactly. Luckily for you, we’ve compiled a short list below of some of the better starter plugins available that are well written and reliable – if you select one to use regularly then you will quickly get to know the code structure and how to use it most effectively.

Where can I find starter plugins?

There are many starter plugins available for your use, but after doing some research of our own we can highly recommend these three solid and functional examples:

There are a number of others out there of course, so if one of these doesn’t quite work for your coding style I’m sure you can find one that does. Some of these plugins come with scripts that enable you to duplicate the code and rename all the necessary strings in a few seconds, while others will require you to copy the files and rename everything yourself – either way, it’s a far sight quicker than writing everything from scratch every time you start a new plugin.

Are there any other starter plugins that you use? Do you have your own that you’ve written? Let us know in the comments!
cta-banner-10-product-page-v2_2x

3 Responses

  1. Sebastien
    September 18, 2014 at 3:17 pm #

    I released a Payment Gateway Boilerplate for WooCommerce. https://github.com/seb86/WooCommerce-Payment-Gateway-Boilerplate

    • Hugh Lashbrooke
      September 19, 2014 at 6:58 am #

      That’s awesome Seb – thanks for sharing!

  2. tHe-BiNk
    September 19, 2014 at 2:10 am #

    Thanks, for the github links!