diff --git a/includes/class-sp-player-list.php b/includes/class-sp-player-list.php index 85153bdd..21829300 100644 --- a/includes/class-sp-player-list.php +++ b/includes/class-sp-player-list.php @@ -374,6 +374,24 @@ class SP_Player_List extends SP_Secondary_Post { 'terms' => $season_ids ); endif; + + $team_key = 'sp_team'; + if ( $team ): + switch ( $era ): + case 'current': + $team_key = 'sp_current_team'; + break; + case 'past': + $team_key = 'sp_past_team'; + break; + endswitch; + $args['meta_query'][] = array( + array( + 'key' => $team_key, + 'value' => $team + ), + ); + endif; if ( $this->date !== 0 ): if ( $this->date == 'w' ): @@ -412,6 +430,7 @@ class SP_Player_List extends SP_Secondary_Post { // Add all team performance if ( is_array( $team_performance ) ): foreach ( $team_performance as $team_id => $players ): + if ( $team && $team_id != $team ) continue; if ( is_array( $players ) ): foreach ( $players as $player_id => $player_performance ): if ( array_key_exists( $player_id, $totals ) && is_array( $totals[ $player_id ] ) ): diff --git a/includes/class-sp-player.php b/includes/class-sp-player.php index 66534334..c16d5888 100644 --- a/includes/class-sp-player.php +++ b/includes/class-sp-player.php @@ -802,13 +802,9 @@ class SP_Player extends SP_Custom_Post { $labels = array(); - if ( 'no' === get_option( 'sportspress_player_show_statistics', 'yes' ) ) { - $merged = array(); - } else { - $labels['name'] = __( 'Season', 'sportspress' ); - $labels['team'] = __( 'Team', 'sportspress' ); - } - + $labels['name'] = __( 'Season', 'sportspress' ); + $labels['team'] = __( 'Team', 'sportspress' ); + if ( 'no' === get_option( 'sportspress_player_show_total', 'no' ) ) { unset( $merged[-1] ); } diff --git a/templates/event-blocks.php b/templates/event-blocks.php index 29cdf872..c17e88b8 100644 --- a/templates/event-blocks.php +++ b/templates/event-blocks.php @@ -172,7 +172,7 @@ if ( $title )