Make WordPress Core


Ignore:
Timestamp:
05/19/2016 09:47:06 PM (9 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-info.php

    r36682 r37466  
    144144<h1 id="edit-site"><?php echo $title; ?></h1>
    145145<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>
    146 <h2 class="nav-tab-wrapper nav-tab-small wp-clearfix">
    147146<?php
    148 $tabs = array(
    149     'site-info'     => array( 'label' => __( 'Info' ),     'url' => 'site-info.php'     ),
    150     'site-users'    => array( 'label' => __( 'Users' ),    'url' => 'site-users.php'    ),
    151     'site-themes'   => array( 'label' => __( 'Themes' ),   'url' => 'site-themes.php'   ),
    152     'site-settings' => array( 'label' => __( 'Settings' ), 'url' => 'site-settings.php' ),
    153 );
    154 foreach ( $tabs as $tab_id => $tab ) {
    155     $class = ( $tab['url'] == $pagenow ) ? ' nav-tab-active' : '';
    156     echo '<a href="' . $tab['url'] . '?id=' . $id .'" class="nav-tab' . $class . '">' . esc_html( $tab['label'] ) . '</a>';
    157 }
    158 ?>
    159 </h2>
    160 <?php
     147
     148network_edit_site_nav( array(
     149    'blog_id'  => $id,
     150    'selected' => 'site-info'
     151) );
     152
    161153if ( ! empty( $messages ) ) {
    162154    foreach ( $messages as $msg ) {
Note: See TracChangeset for help on using the changeset viewer.