-
Notifications
You must be signed in to change notification settings - Fork 0
PLUGINS.md
Jason Brain edited this page Jan 10, 2026
·
1 revision
In the Human CMS analogy, the Core is the Brain (Logic) and CNS. Plugins are Learned Skills. Just as learning to play the piano doesn't change your DNA, a plugin shouldn't hack the Core files. It adds new capabilities on top of the existing system.
- Core: Handles routing, database connection, and basic page rendering.
- Plugins: Handle specialized tasks (Events, E-commerce, Forums).
All plugins reside in the /plugins directory. Each plugin gets its own folder.
/plugins
└── /event-planner # The Plugin Slug
├── init.php # Entry point (Hooks & Logic)
├── install.php # Database setup (Run on activation)
├── /admin # Admin interface files
│ ├── menu.php # Defines sidebar links
│ └── events.php # Main admin view
└── /templates # Frontend views (optional)
To keep the Admin Panel (/admin) clean, we don't put plugin files directly in it. Instead, we use a "Proxy" approach:
-
Menu Registration: The plugin provides a
menu.phpthat returns an array of links. - Dynamic Inclusion: The Core Admin sidebar loops through active plugins and includes their menu links.
-
Routing: When you click a plugin link (e.g.,
/admin/plugins/event-planner/events.php), the Core authenticates the user and then loads the file from the plugin directory.
-
Namespaces: Use PHP namespaces or unique prefixes (e.g.,
ep_get_events) to avoid collisions with Core functions. -
Database: Create separate tables (e.g.,
events,bookings) rather than adding columns to thepoststable.
We will implement a simple Hook system (do_action, add_filter) in includes/functions.php.
-
Action: "Do something here" (e.g.,
after_post_save). -
Filter: "Modify this data" (e.g.,
the_content).
-
Discovery: The system scans
/pluginsfor folders. - Activation: Admin toggles "Active".
-
Installation: If
install.phpexists, it runs once to create DB tables. -
Loading:
index.phpchecks theactive_pluginsoption and includesinit.phpfor each active plugin.
See docs/plugins/EVENT_PLANNER.md for the specific implementation of our first plugin.