briannaorg / WordPress-Plugin-Boilerplate

An OOP boilerplate for WordPress plugins.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

About

An OOP boilerplate for WordPress plugins.

License:GNU General Public License v3.0