diff --git a/event.php b/event.php
index 54b17ffb..d724be45 100644
--- a/event.php
+++ b/event.php
@@ -84,7 +84,7 @@ function sp_event_stats_meta( $post ) {
?>
@@ -231,7 +240,7 @@ if ( !function_exists( 'sp_data_table' ) ) {
$values ):
+ foreach ( $stats as $key => $values ):
if ( !$key ) continue;
$is_auto = array_key_exists( 'auto', $values ) ? (int)$values[ 'auto' ] : $pagenow == 'post-new.php';
?>
@@ -253,22 +262,20 @@ if ( !function_exists( 'sp_data_table' ) ) {
?>
- |
+ |
- /> |
+ /> |
- |
+ |
- /> |
+ /> |
diff --git a/player.php b/player.php
index 79391fcc..c5d62caa 100644
--- a/player.php
+++ b/player.php
@@ -41,7 +41,7 @@ function sp_player_stats_meta( $post ) {
$data = sp_array_combine( $teams, sp_array_value( $stats, 0, array() ) );
?>
-
+
term_id, array() ) );
?>
name; ?>
- term_id, array( 'Team', 'Played', 'Goals', 'Assists', 'Yellow Cards', 'Red Cards' ) ); ?>
+ term_id, array( 'Team', 'Played', 'Goals', 'Assists', 'Yellow Cards', 'Red Cards' ) ); ?>
ID, 'sp_team', false );
$stats = (array)get_post_meta( $post->ID, 'sp_stats', true );
- $data = sp_array_combine( $teams, sp_array_value( $stats, 0, array() ) );
- sp_data_table( $data, 0, array( 'Team', 'P', 'W', 'D', 'L', 'F', 'A', 'GD', 'Pts' ), false );
+ $leagues = (array)get_the_terms( $post->ID, 'sp_league' );
+ foreach ( $leagues as $league ):
+ if ( is_object( $league ) && property_exists( $league, 'term_id' ) )
+ $index = $league->term_id;
+ else
+ $index = 0;
+
+ $data = sp_array_combine( $teams, sp_array_value( $stats, $index, array() ) );
+
+ $placeholders = array();
+ foreach ( $teams as $team ):
+ $placeholders[ $team ] = sp_get_stats( $team, 0, $index );
+ endforeach;
+
+ sp_stats_table( $data, $placeholders, $index, array( 'Team', 'P', 'W', 'D', 'L', 'F', 'A', 'GD', 'Pts' ), false );
+ endforeach;
}
?>
\ No newline at end of file
diff --git a/team.php b/team.php
index 8ec189f9..d0c07ac2 100644
--- a/team.php
+++ b/team.php
@@ -48,7 +48,7 @@ function sp_team_stats_meta( $post ) {
$data = sp_array_combine( $keys, sp_array_value( $stats, 0, array() ) );
?>
-