Hide team column in player statistics for player-vs-player sports

This commit is contained in:
Brian Miyaji
2016-05-03 14:09:18 +10:00
parent de720ba15c
commit 3ba578c41a
3 changed files with 20 additions and 13 deletions

View File

@@ -5,7 +5,7 @@
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 2.0.3
* @version 2.0.5
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -94,14 +94,7 @@ class SP_Meta_Box_Player_Statistics {
<th><?php _e( 'Season', 'sportspress' ); ?></th>
<?php if ( $team_select && apply_filters( 'sportspress_player_team_statistics', $league_id ) ): ?>
<th>
<?php if ( $has_checkboxes ): ?>
<label for="sp_columns_team">
<input type="checkbox" name="sp_columns[]" value="team" id="sp_columns_team" <?php checked( ! is_array( $columns ) || array_key_exists( 'team', $columns ) ); ?>>
<?php _e( 'Team', 'sportspress' ); ?>
</label>
<?php else: ?>
<?php _e( 'Team', 'sportspress' ); ?>
<?php endif; ?>
<?php _e( 'Team', 'sportspress' ); ?>
</th>
<?php endif; ?>
<?php foreach ( $columns as $key => $label ): if ( $key == 'team' ) continue; ?>
@@ -115,7 +108,7 @@ class SP_Meta_Box_Player_Statistics {
<td>
<label><strong><?php _e( 'Total', 'sportspress' ); ?></strong></label>
</td>
<?php if ( $team_select ) { ?>
<?php if ( $team_select && apply_filters( 'sportspress_player_team_statistics', true ) ) { ?>
<td>&nbsp;</td>
<?php } ?>
<?php foreach ( $columns as $column => $label ): if ( $column == 'team' ) continue;

View File

@@ -1,4 +1,13 @@
<?php
/**
* Player Statistics for Single Competition
*
* @author ThemeBoy
* @category Admin
* @package SportsPress/Admin/Meta_Boxes
* @version 2.0.5
*/
// The first row should be column labels
$labels = $data[0];

View File

@@ -4,7 +4,7 @@
*
* @author ThemeBoy
* @package SportsPress/Templates
* @version 2.0.3
* @version 2.0.5
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
@@ -17,6 +17,7 @@ $player = new SP_Player( $id );
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
$sections = get_option( 'sportspress_player_performance_sections', -1 );
$show_teams = apply_filters( 'sportspress_player_team_statistics', true );
$leagues = get_the_terms( $id, 'sp_league' );
$positions = $player->positions();
$player_sections = array();
@@ -53,11 +54,15 @@ if ( is_array( $leagues ) ):
}
}
sp_get_template( 'player-statistics-league.php', array(
$args = array(
'data' => $player->data( $league->term_id, false, $section_id ),
'caption' => $caption,
'scrollable' => $scrollable,
) );
);
if ( ! $show_teams ) {
$args['hide_teams'] = true;
}
sp_get_template( 'player-statistics-league.php', $args );
endforeach;
sp_get_template( 'player-statistics-league.php', array(