Trying to apply 12 factor app and agile principles to wordpress development is tricky. When a developer needs to deliver on a feature request, for those passionate about software engineering best practices, the standard options available seem a bit down and dirty. I’ll tell you how using a plugin boilerplate can help.Often adding stuff to the functions.php file and finding off-the-shelf plugin loaded of bloatware seems a bit like hacking to get the desired outcome.
The other general problem with wordpress development is that it isn’t fully object oriented. Which is why some in the industry roll their eyes every-time you mention the core. And I agree with them to a certain extent. It can be very clunky to those with experience of other PHP frameworks. But no-one can deny the uptake for wordpress and it’s awesomeness as a cms for the masses.
Therefore, developers should to take a pragmatic approach when building with wordpress, it needs coaching to help make it a better beast, we should aim to make it’s back-end as popular with developers as it’s admin is to users.
One of the ways I have achieved this in recent projects, is by using the wicked WordPress Plugin Boilerplate. It has two cool reasons to use it. Firstly, it let’s you specify all the key plugin meta data by using a convenient form. Secondly, it builds your plugin packaged as a zip in an lightweight object oriented structure.
Using the boilerplate, you don’t have to do any hooking, filtering or enqueueing, you just start coding straight into the already available files, and your plugin starts functioning. This isn’t just about getting plugins to functioning faster. If you use the same structure for every plugin, it makes it easier for you and collaborators to locate where certain functionality resides.
On thing to be careful of, is that the boilerplate, by default, loads in a javascript and css file for both the admin and front-end, which when using the boilerplate a number of times, means more HTTP requests when pages are loaded. If you don’t need to enqueue these types of files, then you can either comment out the enqueue line or, concatenate all your script files for snappier load times. The latter wont happen out of the box, but you can use your preferred automation tool to do this, my choice would be gulp.