Skip to content

Create a plugin

Robert Isoski edited this page Jan 14, 2020 · 3 revisions

Plugin requirements (WonderCMS v3.x.x and above)

  • Your plugin folder must reside in the plugins folder (example.com/plugins/plugin-name).
  • IMPORTANT: plugin-name.php must have the same name as the plugin folder name.
    • For example, if your plugin folder name is plugin-name, then the main file must also be plugin-name.php.
  • WonderCMS always loads the plugins folder, meaning it will automatically include your plugin.

List of available hooks/listeners

  • Listeners are used for attaching your functions to different parts of WonderCMS.
 $Wcms->addListener('page', 'yourFunctionName'); // attach your custom function to the page
 $Wcms->addListener('js', 'yourFunctionName'); // can be used for additional JavaScript
 $Wcms->addListener('css', 'yourFunctionName'); // can be used for additional CSS
 $Wcms->addListener('settings', 'yourFunctionName' // );
 $Wcms->addListener('menu', 'yourFunctionName');
 $Wcms->addListener('getMenuSettings', 'yourFunctionName');
 $Wcms->addListener('footer', 'yourFunctionName');

These listeners can be used in your main plugin file.

Plugin examples

Clone this wiki locally