WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/19/2016 09:47:06 PM (3 years ago)
Author:
jeremyfelt
Message:

Multisite: Filter the links displayed on "Edit Site" views

Introduce the network_edit_site_nav function, which DRYs up the code used to display a common set of links at the top of "Edit Site" views.

Introduce the network_edit_site_nav_links filter, which allows plugins to modify the list of links displayed at the top of Edit Site views as a "tabbed" interface.

Props johnjamesjacoby, c3mdigital, Bueltge.
Fixes #15800.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/network/site-users.php

    r36171 r37466  
    205205<h1 id="edit-site"><?php echo $title; ?></h1>
    206206<p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p>
    207 <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix">
    208 <?php
    209 $tabs = array(
    210     'site-info'     => array( 'label' => __( 'Info' ),     'url' => 'site-info.php'     ),
    211     'site-users'    => array( 'label' => __( 'Users' ),    'url' => 'site-users.php'    ),
    212     'site-themes'   => array( 'label' => __( 'Themes' ),   'url' => 'site-themes.php'   ),
    213     'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ),
    214 );
    215 foreach ( $tabs as $tab_id => $tab ) {
    216     $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : '';
    217     echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>';
    218 }
    219 ?>
    220 </h2><?php
     207<?php
     208
     209network_edit_site_nav( array(
     210    'blog_id'  => $id,
     211    'selected' => 'site-users'
     212) );
    221213
    222214if ( isset($_GET['update']) ) :
Note: See TracChangeset for help on using the changeset viewer.