-
Notifications
You must be signed in to change notification settings - Fork 0
The basics of creating a plugin with Lava
danielchatfield edited this page Feb 22, 2012
·
10 revisions
All Lava Plugins follow the same basic structure and are contained within the wp-content\plugins\
directory like all other WordPress plugins. Lava does not currently support being placed in the Must Use directory.
- plugin.php (required)
- pluginCallbacks.php (optional but only extremely simple plugins wouldn't need one)
- branding.php (optional)
- /lava/ - contains all the framework code
- /skins/ - if the plugin displays something to the public (like a login page) then it should use the lava skins api
- /extensions/ - This directory contains code which is not generic enough to be part of the main plugin (prevents the plugin being cluttered with loads of features)
- /_static/ - This directory holds all of the images, css and javascript for the plugin admin page that isn't provided by lava.
Now you know about the basic file structure for a plugin lets delve in and explore how to make a plugin.
The file plugin.php
can be thought as the controller for your plugin. It contains the plugin header which tells WordPress what the plugin is called, who made it and what version it is.
<?php
/*
Plugin Name: My Awesome Plugin
Plugin URI:
Description: Short description of your plugin
Version: 1.0.0
Author: Daniel Chatfield
Author URI: http://www.volcanicpixels.com
License: GPLv2
*/
?>
<?php
include( dirname( __FILE__ ) ."/lava/lava.php" );
$pluginName = "My Awesome Plugin";
$pluginVersion = "1.0.0";
$thePlugin = lava::newPlugin( __FILE__, $pluginName, $pluginVersion );
$pluginSlug = $thePlugin->_slug();
/**
* Define the plugin settings:
* Use this space to list all the settings that you are defining
*/
/**
* Define the plugin admin pages:
* Use this space to list all of the admin pages that are being defined
*/
?>