If you’re thinking about building a WordPress Widget or Plugin, you want to make sure you take the right approach. The world already has plenty of poorly coded widgets and plugins, there’s no reason to continue contributing anymore bad code into the WordPress community.
I have seen so many good plugin and widget ideas that failed at execution or broke too easily. Having a solid foundation and following a proven outline can make a huge difference.
When Tom McFarlin, co-founder of 8BIT, announced he was organizing a widget and plugin boilerplate, I was pretty excited.
WordPress Widget Boilerplate
The WordPress Widget Boilerplate features include:
- File Organization
The Boilerplate ships with both JavaScript sources and stylesheets for both the administrator and the client-side views. It provides a basic localization file to make it easy to localize the plugin. It also includes a stubbed out README that follows WordPress conventions. - Documented Code
Each file of the plugin and each method of the core code is clearly documented for its purpose in the overall plugin. Additionally, the core code includes various TODO’s to make it easy for your IDE to locate everything you need to populate when working on your plugin. - API Implementation
The Boilerplate is based on the WordPress API in order to enforce best practices when building on top of the WordPress platform. This makes it easy to develop conventional, familiar code and makes it easy to compare your work with the recommendations of the Codex.
The WordPress Widget Boilerplate is available on GitHub and is currently under active development.
Check it out, fork it, or contribute.
WordPress Plugin Boilerplate
The WordPress Plugin Boilerplate includes the following features:
- File Organization
The Boilerplate ships with both JavaScript sources and stylesheets for both the administrator and the client-side views. It provides a basic localization file to make it easy to localize the plugin. It also includes a stubbed out README that follows WordPress conventions. - Documented Code
Each file of the plugin and each method of the core code is clearly documented for its purpose in the overall plugin. Additionally, the core code includes various TODO’s to make it easy for your IDE to locate everything you need to populate when working on your plugin. - API Implementation
The Boilerplate is based on the WordPress API in order to enforce best practices when building on top of the WordPress platform. This makes it easy to develop conventional, familiar code and makes it easy to compare your work with the recommendations of the Codex. - Action and Filter References
One of the challenges of working with plugins is managing actions and filters. The Boilerplate includes references to all WordPress documentation of both and already includes two templates for both actions and filters.
The WordPress Plugin Boilerplate is available on GitHub and is currently under active development.
Check it out, fork it, or contribute.
[via More Code]
Tom McFarlin says
Thanks for covering these – and yes, the more people that contribute, the better!
The Widget Boilerplate already received a number of awesome pull requests :).
Eric Dye says
We only cover awesome stuff … so … uh … yeah. 😉
Cliff says
Now THIS will save me some time!
Eric Dye says
WOOT!
Phil Schneider says
This might actually make it possible for me to get into coding.
Eric Dye says
Tom has that effect on people.