diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php
index dd4a6929..1a448e12 100644
--- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php
+++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-list-data.php
@@ -20,9 +20,9 @@ class SP_Meta_Box_List_Data {
*/
public static function output( $post ) {
$list = new SP_Player_List( $post );
- list( $columns, $data, $placeholders, $merged ) = $list->data( true );
+ list( $columns, $data, $placeholders, $merged, $orderby ) = $list->data( true );
$adjustments = $list->adjustments;
- self::table( $columns, $data, $placeholders, $adjustments );
+ self::table( $columns, $data, $placeholders, $adjustments, $orderby );
}
/**
@@ -36,7 +36,7 @@ class SP_Meta_Box_List_Data {
/**
* Admin edit table
*/
- public static function table( $columns = array(), $data = array(), $placeholders = array(), $adjustments = array() ) {
+ public static function table( $columns = array(), $data = array(), $placeholders = array(), $adjustments = array(), $orderby = 'number' ) {
$show_player_photo = get_option( 'sportspress_list_show_photos', 'no' ) == 'yes' ? true : false;
?>
@@ -47,14 +47,17 @@ class SP_Meta_Box_List_Data {
- | # |
+ |
|
|
$label ): ?>
-
+
|
@@ -76,7 +79,15 @@ class SP_Meta_Box_List_Data {
$default_name = get_the_title( $player_id );
?>
- |
+
+
+ |
@@ -105,7 +116,7 @@ class SP_Meta_Box_List_Data {
?>
|
$label ):
- if ( $column == 'team' ) continue;
+ if ( in_array( $column, array( 'number', 'team' ) ) ) continue;
$value = sp_array_value( $player_stats, $column, '' );
$placeholder = sp_array_value( sp_array_value( $placeholders, $player_id, array() ), $column, 0 );
?>
diff --git a/includes/class-sp-player-list.php b/includes/class-sp-player-list.php
index 337dcbde..1da5f609 100644
--- a/includes/class-sp-player-list.php
+++ b/includes/class-sp-player-list.php
@@ -357,13 +357,15 @@ class SP_Player_List extends SP_Custom_Post {
if ( $admin ):
$labels = array();
foreach( $this->columns as $key ):
- if ( $key == 'team' ):
+ if ( $key == 'number' ):
+ $labels[ $key ] = '#';
+ elseif ( $key == 'team' ):
$labels[ $key ] = __( 'Team', 'sportspress' );
elseif ( array_key_exists( $key, $columns ) ):
$labels[ $key ] = $columns[ $key ];
endif;
endforeach;
- return array( $labels, $data, $placeholders, $merged );
+ return array( $labels, $data, $placeholders, $merged, $orderby );
else:
if ( ! is_array( $this->columns ) )
$this->columns = array();
@@ -373,9 +375,10 @@ class SP_Player_List extends SP_Custom_Post {
endif;
endforeach;
- $labels = array( 'name' => __( 'Player', 'sportspress' ) );
- if ( in_array( 'team', $this->columns ) )
- $labels['team'] = __( 'Team', 'sportspress' );
+ $labels = array();
+ if ( in_array( 'number', $this->columns ) ) $labels['number'] = '#';
+ $labels['name'] = __( 'Player', 'sportspress' );
+ if ( in_array( 'team', $this->columns ) ) $labels['team'] = __( 'Team', 'sportspress' );
$merged[0] = array_merge( $labels, $columns );
return $merged;
diff --git a/templates/player-list.php b/templates/player-list.php
index 884d5fbb..4c27e173 100644
--- a/templates/player-list.php
+++ b/templates/player-list.php
@@ -84,14 +84,16 @@ foreach ( $groups as $group ):
$output .= '