An opinionated fork of the WordPress Plugin Boilerplate.
-
Use the WP Plugin Generator
-
Create settings fields by adding to the array in the render method in
admin/class-admin.php. -
Get the data from your settings fields in the render method in
frontend/class-frontend.phpwhere it says controller. -
Use that data in your default template found in
frontend/partials/view.php. -
Users will have the ability to create their own template in a folder called
partials/plugin-name.phpin their theme. All the variables you declare in the controller will be accessible to them. -
Here is an example of how to make an AJAX call in the admin.
If you did not use the generator, change the following generic info:
- Namespaces in all PHP files -
namespace PLUGIN_NAME; ./plugin-nameplugin-name.phpclass-info.php-SLUG,VERSION,OPTION_NAME,UPDATE_URL- Make sure the
UPDATE_URLhas a trailing slash at the end frontend/class-frontend.php- assets methodfronend/js/plugin-name-frontend.jsfronend/css/plugin-name-frontend.cssadmin/class-admin.php- assets methodadmin/class-admin.php- text domainadmin/js/plugin-name-admin.jsadmin/css/plugin-name-admin.cssuninstall.php- option names