Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various improvements inspired my Multisite admin menu #148

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,42 @@ public function admin_bar( $wp_admin_bar ) {
),
) );

if ( is_super_admin() ) {
$wp_admin_bar->add_group(array(
'parent' => 'my-networks',
'id' => 'my-networks-super-admin',
));

$wp_admin_bar->add_menu(array(
'parent' => 'my-networks-super-admin',
'id' => 'networks-admin',
'title' => __('Networks Admin', 'wp-multi-network'),
'href' => network_admin_url(),
));

$wp_admin_bar->add_menu(array(
'parent' => 'networks-admin',
'id' => 'networks-admin-d',
'title' => __('All Networks', 'wp-multi-network' ),
'href' => network_admin_url( 'admin.php?page=networks' ),
));

$wp_admin_bar->add_menu(array(
'parent' => 'networks-admin',
'id' => 'networks-admin-s',
'title' => __('Add New', 'wp-multi-network' ),
'href' => network_admin_url('admin.php?page=add-new-network'),
));
}

$wp_admin_bar->add_group( array(
'parent' => 'my-networks',
'id' => 'group-network-admin',
'meta' => array(
'class' => is_super_admin() ? 'ab-sub-secondary' : '',
),
) );

foreach ( $networks as $network_id ) {
$network = get_network( $network_id );
if ( ! $network ) {
Expand All @@ -98,7 +134,7 @@ public function admin_bar( $wp_admin_bar ) {
) );

$wp_admin_bar->add_menu( array(
'parent' => 'group-network-admin-' . $network_id,
'parent' => 'group-network-admin',
'id' => 'network-admin-' . $network_id,
'title' => $network->site_name,
'href' => network_admin_url(),
Expand Down