-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcustom_menu.php
47 lines (39 loc) · 1.27 KB
/
custom_menu.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
<?php
/* Custom Menu Plugin */
// Registration
register_plugin_custom_menu();
function register_plugin_custom_menu() {
// Plugin ID
$thisfile = basename(__FILE__, '.php');
// language
i18n_merge($thisfile) || i18n_merge($thisfile, 'en_US');
// requires
require_once(GSPLUGINPATH . $thisfile . '/php/plugin.class.php');
require_once(GSPLUGINPATH . $thisfile . '/php/data.class.php');
require_once(GSPLUGINPATH . $thisfile . '/php/display.class.php');
require_once(GSPLUGINPATH . $thisfile . '/php/placeholder.class.php');
// Register plugin
register_plugin(
CustomMenu::FILE,
CustomMenu::i18n_r('PLUGIN_NAME'),
CustomMenu::VERSION,
CustomMenu::AUTHOR,
CustomMenu::URL,
CustomMenu::i18n_r('PLUGIN_DESC'),
CustomMenu::PAGE,
'CustomMenu::admin'
);
// Activate actions/filters
// front-end
// Placeholder content filter
add_filter('content', 'CustomMenuPlaceholder::filter');
// back-end
// Plugin sidebar
add_action(CustomMenu::PAGE . '-sidebar', 'createSideMenu' , array(CustomMenu::FILE, CustomMenu::i18n_r('PLUGIN_SIDEBAR'))); // sidebar link
}
// Public functions
// Print a custom menu
function get_custom_menu($name, $classes = array()) {
$menu = new CustomMenuDisplay($name, $classes);
$menu->displayMenu();
}