-
Notifications
You must be signed in to change notification settings - Fork 4
/
multisitesharedmenu.php
executable file
·53 lines (42 loc) · 1.96 KB
/
multisitesharedmenu.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
<?php
/*
* Plugin Name: Multisite Master Shared Menu
* Plugin URI: http://www.bengreeley.com/menufromsite
* Description: Allows users in a WordPress multisite network pull in a menu from another site in order to achieve a universal navigation or shared navigation without needing to manually recreate menus. Site is required to be installed on WordPress Multisite environment.
* Version: 1.2
* Author: Ben Greeley
* Author URI: http://www.bengreeley.com
*/
/*
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
// If this file is called directly, abort.
if ( ! defined( 'WPINC' ) ) {
die;
}
// Activation code for plugin to create necessary fields, etc.
function activate_menufromsite() {
require_once plugin_dir_path( __FILE__ ) . 'inc/class-menufromsite-activator.php';
MasterSharedMenu_Activator::activate();
}
register_activation_hook( __FILE__, 'activate_menufromsite' );
// The code that runs during plugin deactivation.
function deactivate_menufromsite() {
require_once plugin_dir_path( __FILE__ ) . 'inc/class-menufromsite-deactivator.php';
MasterSharedMenu_Deactivator::deactivate();
}
register_deactivation_hook( __FILE__, 'deactivate_menufromsite' );
require plugin_dir_path( __FILE__) . 'inc/class-menufromsite.php';
if( is_multisite() ) {
// Only run this menu if in multisite...
new MasterSharedMenu();
}