This is just a boilerplate for developing your new amazing WordPress plugin. Here are some features that already available out of the box:
- Easy configurable plugin settings.
- An autoloader that supports WordPress-style class naming and namespaces.
- A well-organized folder structure to facilitate your work.
- A singleton trait to ensure certain classes are only initialized once.
- Support for SCSS and JS minification.
- An example of PHP configuration.
- A Renderer class and template examples.
- A DB manager class with usage examples.
- An example of shortcode registration.
- An example of registering ajax calls.
-
Clone the repository
git clone https://github.com/zahardev/wp-plugin-boilerplate.git
-
Remove .git folder
-
Enable the plugin
-
To check the plugin functionality, please try the following shortcode:
[example_shortcode]
- Rename folder wp-plugin-boilerplate and file wp-plugin-boilerplate.php.
- Replace WPPLGNBLRPLT with your unique plugin prefix in all the plugin files.
- Replace wpplgnblrplt with your unique plugin prefix in all the plugin files.
- Replace WP_Plugin_Boilerplate namespace with your plugin namespace in all the plugin files.
- Update your package.json file with your plugin description.
- Replace translation domain 'wp-plugin-boilerplate-domain' with your translation domain.
- For JS data: replace
boilerplateData
with your unique data key. - Remove all the unnecessary functionality.
For frontend development, you need to install development dependencies:
npm install
After that, you can run the watch process:
npm run watch
And, when you're ready to push your changes live, run:
npm run prod
Please feel free to fork or pull request.