Skip to content
This repository has been archived by the owner on Jan 23, 2019. It is now read-only.

theantichris/WordPress-Plugin-Boilerplate

Repository files navigation

WordPress Plugin Boilerplate

Introduction

This is an object oriented boilerplate for developing a WordPress plugin.

The main class uses the Singleton pattern to make sure that only one instance of the plugin is ever created.

Blank methods for activation, deactivation, and registering scripts and styles are included and tied to the correct hooks.

The base class sets up the text domain for internationalization and localization. Just drop your i18n and l10n files into the lang directory and change the $text_domain property to your text domain.

A blank uninstall file is included. It is setup to make sure it can only be called from the WordPress dashboard.

All custom plugin functionality should be added to the run_plugin() method.

Setup

  1. Clone or download the source to your plugin directory
  2. Rename the folder to the name of your plugin
  3. Rename wordpress-plugin-boilerplate.php to NAME_OF_YOUR_PLUGIN.php
  4. Rename the WordPress_Plugin_Boilerplate class to NAME_OF_YOUR_PLUGIN
  5. Change the class name in the WordPress_Plugin_Boilerplate::get_instance(); line to the name of your class
  6. Update the plugin header with your plugins information
  7. Set the $text_domain property to your text domain
    • This is only needed if you are using text domains for i18n and i10n
  8. Start coding