+
+ sprintf( __( 'All %s', 'sportspress' ), __( 'Leagues', 'sportspress' ) ),
+ 'taxonomy' => 'sp_league',
+ 'name' => 'sportspress[sp_league]',
+ 'selected' => $league
+ );
+ sp_dropdown_taxonomies( $args );
+ ?>
+
+ ID, 'sp_team', 'block', 'sp_league' );
+ sp_post_adder( 'sp_team' );
+ ?>
+
+ ID, 'sp_team', false );
$stats = (array)get_post_meta( $post->ID, 'sp_stats', true );
- $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 );
+ $league = (int)get_post_meta( $post->ID, 'sp_league', true );
+ $data = sp_array_combine( $teams, sp_array_value( $stats, $league, array() ) );
+ $placeholders = array();
+ foreach ( $teams as $team ):
+ $placeholders[ $team ] = sp_get_stats( $team, 0, $league );
endforeach;
+ sp_stats_table( $data, $placeholders, $league, array( 'Team', 'P', 'W', 'D', 'L', 'F', 'A', 'GD', 'Pts' ), false );
}
?>
\ No newline at end of file
diff --git a/team.php b/team.php
index d0c07ac2..3fb21005 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() ) );
?>
-