Skip to content

List of hooks

Robert Isoski edited this page Dec 7, 2019 · 15 revisions

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.

WonderCMS and 3.0.0 and above

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?

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?

  • Create a ZIP file of your plugin folder. If your plugin folder is "myAwesomePlugin", create a ZIP file of the "myAwesomePlugin" folder.
  • Upload ZIP file to GitHub (as a release file).
  • Anyone with your ZIP link will be able to install your plugin through the WonderCMS Settings panel.
Clone this wiki locally