WordPress Plugin Boilerplate
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.
- Clone or download the source to your plugin directory
- Rename the folder to the name of your plugin
- Rename wordpress-plugin-boilerplate.php to NAME_OF_YOUR_PLUGIN.php
- Rename the WordPress_Plugin_Boilerplate class to NAME_OF_YOUR_PLUGIN
- Change the class name in the
WordPress_Plugin_Boilerplate::get_instance();line to the name of your class
- Update the plugin header with your plugins information
- Set the $text_domain property to your text domain
- This is only needed if you are using text domains for i18n and i10n
- Start coding