forked from Emerson/Sanity-Wordpress-Plugin-Framework
-
Notifications
You must be signed in to change notification settings - Fork 0
/
example-plugin.php
62 lines (47 loc) · 1.28 KB
/
example-plugin.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php
/*
Plugin Name: Your Plugin Name
Plugin URI: http://www.your-plugin.com
Description: Your well written plugin description.
Author: Your Name
Version: 1.0
Author URI: http://www.your-github-account.com/
*/
// Derive the current path and load up Sanity
$plugin_path = dirname(__FILE__).'/';
if(class_exists('SanityPluginFramework') != true)
require_once($plugin_path.'framework/sanity.php');
/*
* Define your plugin class which extends the SanityPluginFramework
* Make sure you skip down to the end of this file, as there are a few
* lines of code that are very important.
*/
class ExamplePlugin extends SanityPluginFramework {
/*
* Some required plugin information
*/
var $version = '1.0';
/*
* Required __construct() function that initalizes the Sanity Framework
*/
function __construct() {
parent::__construct(__FILE__);
}
/*
* Run during the activation of the plugin
*/
function activate() {
}
/*
* Run during the initialization of Wordpress
*/
function initialize() {
}
}
// Initalize the your plugin
$ExamplePlugin = new ExamplePlugin();
// Add an activation hook
register_activation_hook(__FILE__, array(&$ExamplePlugin, 'activate'));
// Run the plugins initialization method
add_action('init', array(&$ExamplePlugin, 'initialize'));
?>