Skip to content

Create a plugin

Robert Isoski edited this page Nov 7, 2019 · 2 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 should also be plugin-name.php.
  • WonderCMS will automatically include your plugin.

List of available hooks/listeners

  • Listeners are used for attaching your functions to different parts of WonderCMS.
  • These hooks can be used inside your plugin PHP files (example.com/plugins/plugin-name/plugin-name.php).
 $Wcms->addListener('page', 'yourFunctionName'); // attach your 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');

Plugin examples

- Hits counter plugin

- Simple blog plugin

Also check out: How to share your plugin easily with other users)

Clone this wiki locally
You can’t perform that action at this time.