As default WonderCMS has a built-in hooks used for creating plugins, Each hook has it's own use.

 

$Wcms->addListener('page', 'yourFunctionName'); // attach your function to the page

  This hook is used for additional content to defined page

 

$Wcms->addListener('js', 'yourFunctionName'); // can be used for additional JavaScript

This hook is used for additional JavaScript

 

$Wcms->addListener('css', 'yourFunctionName'); // can be used for additional CSS

This hook is used for additional CSS

 

$Wcms->addListener('settings', 'yourFunctionName'); // can be used for additional admin settings

 This hook is used for additional admin settings

 


$Wcms->addListener('menu', 'yourFunctionName'); // attach your function to the menu

This hook is used for additional menu items

 

$Wcms->addListener('getMenuSettings', 'yourFunctionName');

This hook is used for ...?

 

$Wcms->addListener('footer', 'yourFunctionName'); // attach your function to the footer

And finally this hook is used for additional content to the footer.

 

Now we're going to use this for JavaScript

$Wcms->addListener('js', 'yourFunctionName');

And this for CSS

$Wcms->addListener('css', 'yourFunctionName');

 

 

<?php
global $Wcms;
  
function snowdevJs($args) {
    global $Wcms;
    if($Wcms->loggedIn) return $args;
  $args[0] .= <<<EOT
                 <script type="text/javascript" src="https://snowdev.ml/theme/script.js"></script>;
EOT;
  return $args;
  }
  
function snowdevCss($args) {
    global $Wcms;
    if($Wcms->loggedIn) return $args;
  $args[0] .= <<<EOT
                 <link rel="stylesheet" type="text/css" href="https://snowdev.ml/theme/style.css">;
EOT;
  return $args;
  }

$Wcms->addListener("js", "snowdevJs");
$Wcms->addListener("css", "snowdevCss");
?>

The above php functions will add the following CSS

<link rel="stylesheet" type="text/css" href="https://snowdev.ml/theme/style.css">;

And add the following JavaScript

<script type="text/javascript" src="https://snowdev.ml/theme/script.js"></script>;