$team_id ): if ( ! $team_id ) continue; $totals = array(); // Get results for players in the team $players = sportspress_array_between( (array)get_post_meta( $id, 'sp_player', false ), 0, $key ); $data = sportspress_array_combine( $players, sportspress_array_value( $stats, $team_id, array() ) ); $output .= '
| # | '; $output .= '' . __( 'Player', 'sportspress' ) . ' | '; foreach( $performance_labels as $key => $label ): $output .= '' . $label . ' | '; endforeach; $output .= '
|---|---|---|
| ' . $number . ' | '; if ( $link_posts ): $permalink = get_post_permalink( $player_id ); $name = '' . $name . ''; endif; $output .= '' . $name . ' | '; foreach( $performance_labels as $key => $label ): if ( $key == 'name' ) continue; if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ): $value = $row[ $key ]; else: $value = 0; endif; if ( ! array_key_exists( $key, $totals ) ): $totals[ $key ] = 0; endif; $totals[ $key ] += $value; $output .= '' . $value . ' | '; endforeach; $output .= '
| '; $output .= ' | ' . __( 'Total', 'sportspress' ) . ' | '; $row = $data[0]; foreach( $performance_labels as $key => $label ): if ( $key == 'name' ): continue; endif; if ( array_key_exists( $key, $row ) && $row[ $key ] != '' ): $value = $row[ $key ]; else: $value = sportspress_array_value( $totals, $key, 0 ); endif; $output .= '' . $value . ' | '; endforeach; $output .= '