Add per-league statistics editor to team
This commit is contained in:
16
player.php
16
player.php
@@ -36,16 +36,24 @@ function sp_player_stats_meta( $post ) {
|
||||
$teams = (array)get_post_meta( $post->ID, 'sp_team', false );
|
||||
$leagues = (array)get_the_terms( $post->ID, 'sp_league' );
|
||||
$stats = (array)get_post_meta( $post->ID, 'sp_stats', true );
|
||||
|
||||
// Overall
|
||||
$data = sp_array_combine( $teams, sp_array_value( $stats, 0, array() ) );
|
||||
?>
|
||||
<p><strong><?php _e( 'Overall', 'sportspress' ); ?></strong></p>
|
||||
<?php sp_data_table( $data, 0, array( 'Team', 'Played', 'Goals', 'Assists', 'Yellow Cards', 'Red Cards' ) ); ?>
|
||||
<?php
|
||||
|
||||
// Leagues
|
||||
foreach ( $leagues as $league ):
|
||||
if ( !$league ) continue;
|
||||
$data = sp_array_combine( $teams, sp_array_value( $stats, $league->term_id, array() ) );
|
||||
?>
|
||||
<div>
|
||||
<p><strong><?php echo $league->name; ?></strong></p>
|
||||
<?php sp_data_table( $data, $league->term_id, array( 'Team', 'Played', 'Goals', 'Assists', 'Yellow Cards', 'Red Cards' ) ); ?>
|
||||
</div>
|
||||
<p><strong><?php echo $league->name; ?></strong></p>
|
||||
<?php sp_data_table( $data, $league->term_id, array( 'Team', 'Played', 'Goals', 'Assists', 'Yellow Cards', 'Red Cards' ) ); ?>
|
||||
<?php
|
||||
endforeach;
|
||||
|
||||
}
|
||||
|
||||
function sp_player_profile_meta( $post ) {
|
||||
|
||||
Reference in New Issue
Block a user