apply_filters( 'sports_bench_team_stats', $html, $game_info, $away_team, $home_team, $game, $sport )

Type

Filters

Section

Game Recap

Outputs the HTML for the team stats table for a game

Parameters

  • $html, string, the current HTML for the team stats table
  • $game_info, array, the list of game team stats for the selected game
  • $away_team, Sports_Bench_Team object, the team object for the away team
  • $home_team, Sports_Bench_Team object, the team object for the home team
  • $game, Sports_Bench_Game object, the game object for the current game
  • $sport, string, the sport that's being used on the site

Returns

  • string, the HTML for the team stats table

Since: 1.5

Source: basketball-game-info.php, line 53; football-game-info.php, line 75; hockey-game-info.php, line 76; rugby-game-info.php, line 75; soccer-game-info.php, line 73; volleyball-game-info.php, line 54

Example

/**
 * Returns the html for the team stats table for the game recap
 *
 * @param string $html
 *
 * @param array $game_info
 *
 * @param Sports_Bench_Team $away_team
 *
 * @param Sports_Bench_Team $home_team
 *
 * @param Sports_Bench_Game $game
 *
 * @param string $sport
 *
 * @return string, html for the team stats table
 *
 * @since 1.5
 */
function sports_bench_do_team_stats( $html, $game_info, $away_team, $home_team, $game, $sport ) {
	if ( 'basketball' == $sport ) {
		foreach ( $game_info as $info ) {
			$html = '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '';
			$html .= '
' . $away_team->get_team_photo( 'team-logo' ) . '' . $home_team->get_team_photo( 'team-logo' ) . '
' . $away_team->team_abbreviation . '' . $home_team->team_abbreviation . '
' . __( 'Field Goals:', 'sports-bench' ) . '' . $info->game_away_fgm . '/' . $info->game_away_fga . '' . $info->game_home_fgm . '/' . $info->game_home_fga . '
' . __( 'FG Percentage:', 'sports-bench' ) . '' . round( $info->game_away_fgm / $info->game_away_fga, 3 ) * 100 . '' . round( $info->game_home_fgm / $info->game_home_fga, 3 ) * 100 . '
' . __( '3-point Field Goals:', 'sports-bench' ) . '' . $info->game_away_3pm . '/' . $info->game_away_3pa . '' . $info->game_home_3pm . '/' . $info->game_home_3pa . '
' . __( '3-point FG Percentage:', 'sports-bench' ) . '' . round( $info->game_away_3pm / $info->game_away_3pa, 3 ) * 100 . '' . round( $info->game_home_3pm / $info->game_home_3pa, 3 ) * 100 . '
' . __( 'Free Throws:', 'sports-bench' ) . '' . $info->game_away_ftm . '/' . $info->game_away_fta . '' . $info->game_home_ftm . '/' . $info->game_home_fta . '
' . __( 'FT Percentage:', 'sports-bench' ) . '' . round( $info->game_away_ftm / $info->game_away_fta, 3 ) * 100 . '' . round( $info->game_home_ftm / $info->game_home_fta, 3 ) * 100 . '
' . __( 'Off/Def Rebounds:', 'sports-bench' ) . '' . $info->game_away_off_rebound . '/' . $info->game_away_def_rebound . '' . $info->game_home_off_rebound . '/' . $info->game_home_def_rebound . '
' . __( 'Assists:', 'sports-bench' ) . '' . $info->game_away_assists . '' . $info->game_home_assists . '
' . __( 'Steals:', 'sports-bench' ) . '' . $info->game_away_steals . '' . $info->game_home_steals . '
' . __( 'Blocks:', 'sports-bench' ) . '' . $info->game_away_blocks . '' . $info->game_home_blocks . '
' . __( 'Points in the Paint:', 'sports-bench' ) . '' . $info->game_away_pip . '' . $info->game_home_pip . '
' . __( 'Turnovers:', 'sports-bench' ) . '' . $info->game_away_to . '' . $info->game_home_to . '
' . __( 'Points of Turnovers:', 'sports-bench' ) . '' . $info->game_away_steals . '' . $info->game_home_steals . '
' . __( 'Fast Break Points:', 'sports-bench' ) . '' . $info->game_away_fast_break . '' . $info->game_home_fast_break . '
' . __( 'Fouls:', 'sports-bench' ) . '' . $info->game_away_fouls . '' . $info->game_home_fouls . '
'; } } elseif ( 'football' == $sport ) { foreach ( $game_info as $info ) { $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
' . $away_team->get_team_photo( 'team-logo' ) . '' . $home_team->get_team_photo( 'team-logo' ) . '
' . $away_team->team_abbreviation . '' . $home_team->team_abbreviation . '
' . __( 'Total Yards:', 'sports-bench' ) . '' . $info->game_away_total . '' . $info->game_home_total . '
' . __( 'Passing Yards:', 'sports-bench' ) . '' . $info->game_away_pass . '' . $info->game_home_pass . '
' . __( 'Rushing Yards:', 'sports-bench' ) . '' . $info->game_away_rush . '' . $info->game_home_rush . '
' . __( 'Turnovers:', 'sports-bench' ) . '' . $info->game_away_to . '' . $info->game_home_to . '
' . __( 'Interceptions:', 'sports-bench' ) . '' . $info->game_away_ints . '' . $info->game_home_ints . '
' . __( 'Fumbles-Lost:', 'sports-bench' ) . '' . $info->game_away_fumbles . '-' . $info->game_away_fumbles_lost . '' . $info->game_home_fumbles . '-' . $info->game_home_fumbles_lost . '
' . __( 'Possession:', 'sports-bench' ) . '' . $info->game_away_possession . '' . $info->game_home_possession . '
' . __( 'Kick Return-Yards:', 'sports-bench' ) . '' . $info->game_away_kick_returns . '-' . $info->game_away_kick_return_yards . '' . $info->game_home_kick_returns . '-' . $info->game_home_kick_return_yards . '
' . __( 'Penalties-Yards:', 'sports-bench' ) . '' . $info->game_away_penalties . '-' . $info->game_away_penalty_yards . '' . $info->game_home_penalties . '-' . $info->game_home_penalty_yards . '
' . __( 'First Downs:', 'sports-bench' ) . '' . $info->game_away_first_downs . '' . $info->game_home_first_downs . '
'; } } elseif ( 'hockey' == $sport ) { foreach( $game_info as $info ) { $html = ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; if ( $info->game_away_overtime != null ) { $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; } $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
' . $away_team->get_team_photo( 'team-logo' ) . '' . $home_team->get_team_photo( 'team-logo' ) . '
' . $away_team->team_abbreviation . '' . $home_team->team_abbreviation . '
' . __( 'First Period SOG', 'sports-bench' ) . '' . $info->game_away_first_sog . '' . $info->game_home_first_sog . '
' . __( 'Second Period SOG', 'sports-bench' ) . '' . $info->game_away_second_sog . '' . $info->game_home_second_sog . '
' . __( 'Third Period SOG', 'sports-bench' ) . '' . $info->game_away_third_sog . '' . $info->game_home_third_sog . '
' . __( 'Overtime SOG', 'sports-bench' ) . '' . $info->game_away_overtime_sog . '' . $info->game_home_overtime_sog . '
' . __( 'Power Play Opportunities-Goals', 'sports-bench' ) . '' . $info->game_away_power_plays . '-' . $info->game_away_pp_goals . '' . $info->game_home_power_plays . '-' . $info->game_home_pp_goals . '
' . __( 'Penalty Minutes', 'sports-bench' ) . '' . $info->game_away_pen_minutes . '' . $info->game_home_pen_minutes . '
'; } } elseif ( 'rugby' == $sport ) { foreach ( $game_info as $info ) { $html = ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
' . $away_team->get_team_photo( 'team-logo' ) . '' . $home_team->get_team_photo( 'team-logo' ) . '
' . $away_team->team_abbreviation . '' . $home_team->team_abbreviation . '
' . __( 'Tries:', 'sports-bench' ) . '' . $info->game_away_tries . '' . $info->game_home_tries . '
' . __( 'Conversions:', 'sports-bench' ) . '' . $info->game_away_conversions . '' . $info->game_home_conversions . '
' . __( 'Penalty Goals:', 'sports-bench' ) . '' . $info->game_away_penalty_goals . '' . $info->game_home_penalty_goals . '
' . __( 'Kick Percentage:', 'sports-bench' ) . '' . $info->game_away_kick_percentage . '%' . $info->game_home_kick_percentage . '%
' . __( 'Meters:', 'sports-bench' ) . '' . ( $info->game_away_meters_hand + $info->game_away_meters_pass + $info->game_away_meters_runs ) . '' . ( $info->game_home_meters_hand + $info->game_home_meters_pass + $info->game_home_meters_runs ) . '
' . __( 'Kicks From Hand:', 'sports-bench' ) . '' . $info->game_away_meters_hand . '' . $info->game_home_meters_hand . '
' . __( 'Passes:', 'sports-bench' ) . '' . $info->game_away_meters_pass . '' . $info->game_home_meters_pass . '
' . __( 'Runs:', 'sports-bench' ) . '' . $info->game_away_meters_runs . '' . $info->game_home_meters_runs . '
' . __( 'Possession:', 'sports-bench' ) . '' . $info->game_away_possession . '' . $info->game_home_possession . '
' . __( 'Clean Breaks:', 'sports-bench' ) . '' . $info->game_away_clean_breaks . '' . $info->game_home_clean_breaks . '
' . __( 'Defenders Beaten:', 'sports-bench' ) . '' . $info->game_away_defenders_beaten . '' . $info->game_home_defenders_beaten . '
' . __( 'Offload:', 'sports-bench' ) . '' . $info->game_away_offload . '' . $info->game_home_offload . '
' . __( 'Rucks:', 'sports-bench' ) . '' . $info->game_away_rucks . '%' . $info->game_home_rucks . '%
' . __( 'Mauls:', 'sports-bench' ) . '' . $info->game_away_mauls . '' . $info->game_home_mauls . '
' . __( 'Turnovers Conceded:', 'sports-bench' ) . '' . $info->game_away_turnovers_conceeded . '' . $info->game_home_turnovers_conceeded . '
' . __( 'Scrums:', 'sports-bench' ) . '' . $info->game_away_scrums . '' . $info->game_home_scrums . '
' . __( 'Lineouts:', 'sports-bench' ) . '' . $info->game_away_lineouts . '' . $info->game_home_lineouts . '
' . __( 'Penalties Conceded:', 'sports-bench' ) . '' . $info->game_away_penalties_conceeded . '' . $info->game_home_penalties_conceeded . '
' . __( 'Red Cards:', 'sports-bench' ) . '' . $info->game_away_red_cards . '' . $info->game_home_red_cards . '
' . __( 'Yellow Cards:', 'sports-bench' ) . '' . $info->game_away_yellow_cards . '' . $info->game_home_yellow_cards . '
' . __( 'Free Kicks Conceded:', 'sports-bench' ) . '' . $info->game_away_free_kicks_conceeded . '' . $info->game_home_free_kicks_conceeded . '
'; } } elseif ( 'soccer' == $sport ) { foreach ( $game_info as $info ) { $html = ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
' . $home_team->get_team_photo( 'team-logo' ) . '' . $away_team->get_team_photo( 'team-logo' ) . '
' . $home_team->team_abbreviation . '' . $away_team->team_abbreviation . '
' . __( 'Possession:', 'sports-bench' ) . '' . $info->game_home_possession . '' . $info->game_away_possession . '
' . __( 'Shots:', 'sports-bench' ) . '' . $info->game_home_shots . '' . $info->game_away_shots . '
' . __( 'Shots on goal:', 'sports-bench' ) . '' . $info->game_home_sog . '' . $info->game_away_sog . '
' . __( 'Corners:', 'sports-bench' ) . '' . $info->game_home_corners . '' . $info->game_away_corners . '
' . __( 'Offsides:', 'sports-bench' ) . '' . $info->game_home_offsides . '' . $info->game_away_offsides . '
' . __( 'Fouls:', 'sports-bench' ) . '' . $info->game_home_fouls . '' . $info->game_away_fouls . '
' . __( 'Saves:', 'sports-bench' ) . '' . $info->game_home_saves . '' . $info->game_away_saves . '
' . __( 'Yellow cards:', 'sports-bench' ) . '' . $info->game_home_yellow . '' . $info->game_away_yellow . '
' . __( 'Red cards:', 'sports-bench' ) . '' . $info->game_home_red . '' . $info->game_away_red . '
'; } } elseif ( 'volleyball' == $sport ) { foreach ( $game_info as $info ) { $points = sports_bench_total_points( $game->game_id ); $html = ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
' . $away_team->get_team_photo( 'team-logo' ) . '' . $home_team->get_team_photo( 'team-logo' ) . '
' . $away_team->team_abbreviation . '' . $home_team->team_abbreviation . '
' . __( 'Total Points:', 'sports-bench' ) . '' . $points[ 'away' ] . '' . $points[ 'home' ] . '
' . __( 'Hitting Percentage:', 'sports-bench' ) . '' . number_format( (float) ( $info->game_away_kills - $info->game_away_hitting_errors )/$info->game_away_attacks, 3, '.', '' ) . '' . number_format( (float) ( $info->game_home_kills - $info->game_home_hitting_errors )/$info->game_home_attacks, 3, '.', '' ) . '
' . __( 'Kills:', 'sports-bench' ) . '' . $info->game_away_kills . '' . $info->game_home_kills . '
' . __( 'Blocks:', 'sports-bench' ) . '' . $info->game_away_blocks . '' . $info->game_home_blocks . '
' . __( 'Aces:', 'sports-bench' ) . '' . $info->game_away_aces . '' . $info->game_home_aces . '
' . __( 'Assists:', 'sports-bench' ) . '' . $info->game_away_assists . '' . $info->game_home_assists . '
' . __( 'Digs:', 'sports-bench' ) . '' . $info->game_away_digs . '' . $info->game_home_digs . '
' . __( 'Attacks:', 'sports-bench' ) . '' . $info->game_away_attacks . '' . $info->game_home_attacks . '
' . __( 'Hitting Errors:', 'sports-bench' ) . '' . $info->game_away_hitting_errors . '' . $info->game_home_hitting_errors . '
'; } } return $html; } add_filter( 'sports_bench_team_stats', 'sports_bench_do_team_stats', 10, 6 );