Boilerplate code for WordPress plugins and themes based on best practices.
- A WordPress.org compatible theme: Mo Theme.
- A WordPress.org 'compatible' plugin: Mo Plugin.
- A child theme using the plugin: Mo Pro Theme.
Mo Theme
simply displays posts and comments as required by the WordPress.org theme store without styling.Mo Plugin
adds a custom post type together with a shortcode.Mo Pro Theme
extendsMo Theme
and usesMo Plugin
:- Displays the shortcode added by the
Mo Plugin
. - Extends the homepage from
Mo Theme
by adding a sidebar. - Displays a widget in the sidebar with custom post types added by the
Mo Plugin
. - Displays a settings menu in the admin dashboard where all the above features can be disabled or enabled.
- Displays the shortcode added by the
The answer is two fold.
WordPress has no such thing like this. They provide boilerplate for themes only. There is no boilerplate for plugins, child themes, and how to integrate them.
And, the WordPress boilerplate theme is not class based, in contrast with their recommendation in the Theme Developer Handbook.
Others perhaps have such a combo or maybe not. One of the best WordPress agencies 10up has nothing like this in their public Github repository.
Even if other shops have it, or have parts of it — finding, learning, mixing it into a whole might be more time consuming than this learning by doing approach.
Components are a web development best practice (see Google Material Design) not yet adapted by WordPress.
More Theme Baby has an award winning framework-agnostic component set which should work with WordPress too when WordPress follows the component model.
- Default WordPress files organization
- Class based namespaces
- Components
- Loose coupling
- Single responsibility principle
- Optimized database operations
- Documentation
- Testing (Work in progress)
For details please check each theme's and the plugin's README.md
.
- The WordPress Theme and Plugin Handbook: https://developer.wordpress.org/
- 10up Engineering Best Practices: https://10up.github.io/Engineering-Best-Practices/
- A List Apart's Coding With Clarity: https://alistapart.com/article/coding-with-clarity
- Codular on PHP Classes: http://codular.com/introducing-php-classes
See CHANGELOG.md.