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 531f6628..631ec1c5 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
@@ -66,7 +66,7 @@ class SP_Meta_Box_List_Data {
$i = 0;
foreach ( $data as $player_id => $player_stats ):
if ( !$player_id ) continue;
- $team = get_post_meta( $player_id, 'sp_team', true );
+ $teams = get_post_meta( $player_id, 'sp_team', false );
$div = get_term( $player_id, 'sp_season' );
$number = get_post_meta( $player_id, 'sp_number', true );
@@ -87,7 +87,21 @@ class SP_Meta_Box_List_Data {
-
|
+
+ 'sp_team',
+ 'name' => 'sp_players[' . $player_id . '][team]',
+ 'include' => $include,
+ 'selected' => $selected,
+ 'values' => 'ID',
+ );
+ wp_dropdown_pages( $args );
+ ?>
+ |
$label ):
if ( $column == 'team' ) continue;
$value = sp_array_value( $player_stats, $column, '' );
@@ -118,7 +132,7 @@ class SP_Meta_Box_List_Data {
| # |
|
- $label ): ?>
+ $label ): if ( $key == 'team' ) continue; ?>
|
@@ -138,6 +152,7 @@ class SP_Meta_Box_List_Data {
$label ):
+ if ( $column == 'team' ) continue;
$value = sp_array_value( sp_array_value( $adjustments, $player_id, array() ), $column, '' );
?>
|
diff --git a/includes/class-sp-player-list.php b/includes/class-sp-player-list.php
index b2eea0b5..b64a8284 100644
--- a/includes/class-sp-player-list.php
+++ b/includes/class-sp-player-list.php
@@ -24,6 +24,7 @@ class SP_Player_List extends SP_Custom_Post {
public function __construct( $post ) {
parent::__construct( $post );
$this->columns = get_post_meta( $this->ID, 'sp_columns', true );
+ if ( ! is_array( $this->columns ) ) $this->columns = array();
}
/**
@@ -313,6 +314,7 @@ class SP_Player_List extends SP_Custom_Post {
$merged[ $player_id ] = array();
$player_data['number'] = get_post_meta( $player_id, 'sp_number', true );
$player_data['name'] = get_the_title( $player_id );
+ $player_data['team'] = get_post_meta( $player_id, 'sp_team', true );
foreach( $player_data as $key => $value ):
diff --git a/templates/player-list.php b/templates/player-list.php
index 7da81b9b..33d1247a 100644
--- a/templates/player-list.php
+++ b/templates/player-list.php
@@ -125,16 +125,12 @@ foreach ( $groups as $group ):
$output .= '' . $name . ' | ';
if ( array_key_exists( 'team', $labels ) ):
- $teams = get_post_meta( $player_id, 'sp_current_team' );
- $team_names = array();
- foreach ( $teams as $team ):
- $team_name = get_the_title( $team );
- if ( $link_teams ):
- $team_name = '' . $team_name . '';
- endif;
- $team_names[] = $team_name;
- endforeach;
- $output .= '' . implode( ', ', $team_names ) . ' | ';
+ $team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_team', true ) );
+ $team_name = get_the_title( $team );
+ if ( $link_teams ):
+ $team_name = '' . $team_name . '';
+ endif;
+ $output .= '' . $team_name . ' | ';
endif;
foreach( $labels as $key => $value ):