Skip to content

List of hooks

Robert Isoski edited this page Jul 25, 2022 · 15 revisions

Listeners/hooks are used for creating plugins

Creating a plugin

  • 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 listeners/hooks

  • 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/pluginFolderName/pluginFolderName.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 example: hits counter

How do I make my plugin downloadable by others?

WonderCMS 2.7.0 and older versions

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/pluginFolderName/pluginFolderName.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 example: hits counter

How do I make my plugin downloadable by others?

Clone this wiki locally