Files Overview
Assuming you create “My Cool Plugin” you would have the following files and directories:
my-cool-plugin.php | The main plugin file. This one contains the plugin standard header. This file does a PHP version check and sets up the text domain. |
my-cool-plugin_init.php | This file is called the the main file and initializes the plugin class defined in MyCoolPlugin_Plugin.php. It is separate so that is is not parsed unless PHP version check is successful (otherwise you would get a PHP parse error when trying to activate the plugin) |
MyCoolPlugin_Plugin.php | Your plugin class. This is where your write your code. Extends MyCoolPlugin_LifeCycle. |
MyCoolPlugin_LifeCycle.php | Superclass for MyCoolPlugin_Plugin. Provides lifecycle functions for actions related to installation, uninstall, activate, deactive, and upgrade. Override these functions in MyCoolPlugin_Plugin to add actions. |
MyCoolPlugin_InstallIndicator.php | Superclass of MyCoolPlugin_LifeCycle. Includes functionality for tracking what version of your plugin is installed. |
MyCoolPlugin_OptionsManager.php | Superclass of MyCoolPlugin_InstallIndicator. Provides management functions for options including creating an options page. |
MyCoolPlugin_ShortCodeLoader.php | If you would like to create a short code in its own class, extend this class and implement one abstract function. |
MyCoolPlugin_ShortCodeScriptLoader.php | Like MyCoolPlugin_ShortCodeLoader (a subclass of it) that includes another abstract method to implement aimed at including links to Javascript files in the footer only when a page uses the short code. |
readme.txt | Standard plugin readme.txt file. Example format. Format Validator. Mark-down syntax. |
css/ | Empty directory in which to put style sheets files. |
js/ | Empty directory in which to place javascript files |
languages/ | Empty directory in which to put your i18n files (*.pot, *.po, *.mo) |
Wham bam thank you, ma’am, my quitseons are answered!
It’s really great that people are sharing this information.
I'm no angel but I certainly feel like singing just viewing this cake!! I can imagine the combination of texture and flavor on the tongue and the ohs and ahs of dinner guests. I'm off to plan a party!!Best,Bonnie
Hey, Nice work and practical solution for routine work. I like the way you create a maintainable framework and setup. Keep it up – a great tool to have. Will defo bookmark this site.
Great documentation!