Base plugin for WordPress plugin creation
Note there is a boilerplate framework you can use instead of trying to use this manually:, (*1)
composer create-project flexpress/plugin-framework <pluginname>
You need to create a concreate class that extends the Abstract Plugin class:, (*2)
class MyPlugin extends AbstractPlugin { }
You can optionally override the init method like this:, (*3)
class MyPlugin extends AbstractPlugin { public function init($file) { parent::init($file); } }
This allows you to add your initalisation code for helpers like the taxonomy and post types components., (*4)
Once you are all done setting up your class you need to add the config to pimple:, (*5)
$pimple['myPlugin'] = function(){ return new MyPlugin(); };
Finally to set it up, grab it from pimple and call the init method with the current file, which should be the pluginsname.php file in the root of the plugin folder:
$plugin = $pimple['myPlugin'];
$plugin->init(__FILE__);
, (*6)