The framework uses a manual plugin integration system. Plugins are loaded via plugins/plugins.php, which is included in the of every page when $loadplugins is set to true in config/config.php.
How the Plugin System Works
plugins/plugins.php does two things:
1. Loads assets in the — CSS files and any scripts that need to load early are output directly as the file is included.
2. Builds a $pluginCalledBelowContent string — many JavaScript plugins need to run after the page content exists in the DOM, not in the . Rather than output these scripts immediately, plugins append their tags to the $pluginCalledBelowContent variable. The theme's footer.php then echoes this variable at the very bottom of the page, just before .
This two-phase approach ensures scripts don't block page rendering and that jQuery-dependent code runs after jQuery has loaded.
Built-in Plugins
The following plugins are included and configurable via config/config.php:
| Config variable | Plugin | Notes |
|---|---|---|
$jQuery |
jQuery 3.7.1 + Migrate 3.4.0 | Required by most other plugins |
$anchorLinkAutoClass |
Adds anchor-top-margin class to all links |
Used for smooth scroll margin |
$anchorLinkCurrentURLRewrite |
Rewrites #anchor links to include full page URL |
Required for anchor links to work |
$metaInfoBoxRewriteURL |
Appends ?meta=yes to all links when in meta mode |
Only active when ?meta=yes is in the URL |
$fontAwesome |
Font Awesome 4.7.0 icon library | CSS only, no JS |
$yBox |
yBox lightbox | Loaded below content via $pluginCalledBelowContent |
$editorEnabled |
Page editor (Summernote) | Optional. See the Editor page for setup |
Adding Your Own Plugin
Step 1 — Add your plugin files
Place your plugin's CSS, JS, and any other assets somewhere accessible, typically inside plugins/your-plugin-name/.
Step 2 — Add a config variable
In config/config.php, add a variable to control whether your plugin is active:
$myPlugin = true;
Step 3 — Add to plugins/plugins.php
Open plugins/plugins.php and add a conditional block. Use the in-head pattern for CSS and early-loading scripts:
<?php if ($myPlugin == true) { ?>
<link type="text/css" href="plugins/my-plugin/my-plugin.css" rel="stylesheet" />
<?php } ?>
For JavaScript that needs to run after page content — which is most jQuery plugins — use the $pluginCalledBelowContent pattern instead. Note that single quotes inside the string must be escaped with a backslash:
<?php if ($myPlugin == true) {
$myPluginContent = '
<script src="plugins/my-plugin/my-plugin.js"></script>
<script>
jQuery(document).ready(function($) {
$(\'.my-selector\').myPlugin();
});
});
</script>
';
$pluginCalledBelowContent = $pluginCalledBelowContent . $myPluginContent;
} ?>
Step 4 — Test
Load any page and check that your plugin initialises correctly. If you see JavaScript errors, double-check that all single quotes inside the $myPluginContent string are properly escaped with a backslash (\').
Important: Escaping Quotes
Because plugin scripts are stored as PHP strings, any single quotes inside the JavaScript must be escaped. This is the most common source of errors when adding plugins:
// Wrong — will break the PHP string
$content = '<script>var x = 'hello';</script>';
// Correct — single quotes escaped
$content = '<script>var x = \'hello\';</script>';