Skip to content

Instantly share code, notes, and snippets.

@ninnypants
Created February 28, 2013 04:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save ninnypants/5054232 to your computer and use it in GitHub Desktop.
Save ninnypants/5054232 to your computer and use it in GitHub Desktop.
Show ID column in multisite Sites list table
<?php
/*
Plugin Name: Show Multisite IDs
Plugin URI: http://ninnypants.com
Description: Adds table column to show site ID
Version: 1.0
Author: ninnypants
Author URI: http://ninnypants.com
License: GPL2
Copyright 2013 Tyrel Kelsey (email : tyrel@ninnypants.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
*/
class Show_Multi_Site_IDs {
public function __construct(){
// add_action( 'admin_footer', array( $this, 'show_screen' ) );
add_filter( 'manage_sites-network_columns', array( $this, 'add_column' ) );
add_action( 'manage_sites_custom_column', array( $this, 'display_site_id' ), 10, 2 );
}
public function show_screen(){
$screen = get_current_screen();
var_dump( $screen );
}
public function add_column( $columns ){
$columns['site_id'] = 'ID';
return $columns;
}
public function display_site_id( $column_name, $site_id ){
if( 'site_id' == $column_name )
echo $site_id;
}
}
$show_multisite_ids = new Show_Multi_Site_IDs();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment