I’ve put some love into a proper updating of the wp-plugin
The template, placed in the
~/.grunt-init folder, allows for quick WordPress plugin scaffolding featuring a seed of OOP and TDD techniques, Composer managed library dependencies, and
grunt powered project compilation and building.
npm install -g grunt-init
get hold of the template
git clone [email protected]:lucatume/grunt-wp-plugin.git ~/.grunt-init/wp-plugin
navigate to the folder that will contain the plugin
and start the templating
after answering all the questions install
and that’s it.
The plugin will sport just one class that will take care of hooking into WordPress proper (the
hook method) and will allow for later retrieval of plugin “constants” like the prefix and so on via the
the method (double “the” not an error).
As an example to get hold of the plugin CSS assets folder I would use
and the same would go for the prefix
a singleton instance based access to the plugin main class is possible using the
The template is built to my taste and needs and comes with TDD adapters out of the box.
Using them is as easy as calling WordPress usual methods
and will allow unit testing any class adopting them in isolation.