Creating A Custom Extension
Clone this wiki locally
This is a walkthrough of creating a custom extension.
Imagine you want to add a new language, for example Python.
2. Gather The Prism Extension Files
3. Create The Extension Directory
All extensions are stored in
/vendor/extensions/, every extension in a separate subdirectory.
We now create the directory
/vendor/extensions/Language_Python/ for our extension.
4. Add The Extension PHP Class
- Your PHP class file must be named:
"Prism_Detached_Extension_" + EXTENSION_NAME + ".php"
- Your PHP class must be named:
"Prism_Detached_Extension_" + EXTENSION_NAME
For our example this will be:
- PHP class file:
- PHP class:
Your PHP class must inherit from the base class
For detailed explanations about the base class, please see the wiki page of Extension Base Class.
The extension directory structure currently looks like this:
Your extension PHP class should look something like this (I removed the comments for the sake of brevity - please add at least PHPDoc to your code):
Will My Custom Extension Still Be There After I Updated The Plugin Using The WordPress Plugin Mechanism?
WordPress will remove them. WordPress completely removes the old extension directory and recreates it with the new plugin files. So make a backup of your custom extensions before updating!