WordPress Plugin Boilerplate
Join the DZone community and get the full member experience.Join For Free
For anyone starting out in development or WordPress development it can be difficult to work out the best way of building your WordPress plugins. What's the best way to organize your code and the best way to write your code in the plugin?
Tom McFarlin has created an open source project to help you create your WordPress plugins. The WordPress Plugin Boilerplate is a project that can be found on GitHub and is the ideal code to make a start on your WordPress plugins.
It is a standardized, organized, object-oriented code base for building any WordPress plugin.
The WordPress boilerplate plugin follows the coding standards set out in the Make WordPress coding standards.
It makes it very easy to organize your code in front-end and admin area only code.
To get started on using the boilerplate you can clone the plugin from GitHub.
WordPress Plugin Boilerplate Generator
When you first clone the plugin boilerplate there will be a lot of code that you need to change as the class names will be called things like Plugin_Name. Enrique Chavez has made a Boilerplate plugin generator that allows you to type in the Name of the plugin and it will automatically generate the code for the plugin based on the plugin name you entered into the generator.
To try it out for yourself on your next project you can use the tool here.
Published at DZone with permission of Paul Underwood, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.