apply_filters( 'sports_bench_team_division_standings', $html, $teams, $division_id, $sport )
Type
Filters
Section
Standings
Outputs the HTML for the division/conference standings for a team
Parameters
- $html, string, current HTML for the standings
- $teams, array, the teams in the division/conference standings
- $division_id, integer, the id for the division or conference
- $sport, string, the sport used for the site
Returns
- string, the HTML for the conference/division standings
Since: 1.5
Source: standings.php, line 31
Example
/** * Returns the html for the team division standings table * * @param string $html * * @param array $teams * * @param int $division * * @param string $sport * * @return string, html for the team division standings table * * @since 1.5 */ function sports_bench_do_team_division_standings( $html, $teams, $division, $sport ) { $standings = []; if ( 'soccer' == $sport || 'rugby' == $sport ) { foreach ( $teams as $team ) { $the_team = new Sports_Bench_Team( (int) $team->team_id ); $standing = array( 'team_id' => $the_team->team_id, 'team_link' => $the_team->get_permalink(), 'team_location' => $the_team->team_location, 'games_played' => $the_team->get_games_played( '"' . get_option( 'sports-bench-season-year' ) . '"' ), 'wins' => $the_team->get_wins( '"' . get_option( 'sports-bench-season-year' ) . '"' ), 'losses' => $the_team->get_losses( '"' . get_option( 'sports-bench-season-year' ) . '"' ), 'draws' => $the_team->get_draws( '"' . get_option( 'sports-bench-season-year' ) . '"' ), 'points' => sports_bench_get_points( $the_team->team_id ) ); array_push( $standings, $standing ); } foreach ( $standings as $key => $row ) { $points[ $key ] = $row[ 'points' ]; } array_multisort( $points, SORT_DESC, $standings ); $table_head_styles = apply_filters( 'sports_bench_standings_head_row', '', $division ); $html = '
'; $html .= ' | ' . __( 'GP', 'sports-bench' ) . ' | '; $html .= '' . __( 'W', 'sports-bench' ) . ' | '; $html .= '' . __( 'D', 'sports-bench' ) . ' | '; $html .= '' . __( 'L', 'sports-bench' ) . ' | '; $html .= '' . __( 'PTS', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|---|
' . $team[ 'team_location' ] . ' | '; $html .= '' . $team[ 'games_played' ] . ' | '; $html .= '' . $team[ 'wins' ] . ' | '; $html .= '' . $team[ 'draws' ] . ' | '; $html .= '' . $team[ 'losses' ] . ' | '; $html .= '' . $team[ 'points' ] . ' | '; $html .= '
'; $html .= ' | ' . __( 'W', 'sports-bench' ) . ' | '; $html .= '' . __( 'L', 'sports-bench' ) . ' | '; $html .= '' . __( 'OTL', 'sports-bench' ) . ' | '; $html .= '' . __( 'PTS', 'sports-bench' ) . ' | '; $html .= '
---|---|---|---|---|
' . $team[ 'team_location' ] . ' | '; $html .= '' . $team[ 'wins' ] . ' | '; $html .= '' . $team[ 'losses' ] . ' | '; $html .= '' . $team[ 'overtime_losses' ] . ' | '; $html .= '' . $team[ 'points' ] . ' | '; $html .= '
'; $html .= ' | ' . __( 'W', 'sports-bench' ) . ' | '; $html .= '' . __( 'D', 'sports-bench' ) . ' | '; $html .= '' . __( 'L', 'sports-bench' ) . ' | '; $html .= '' . __( 'GB', 'sports-bench' ) . ' | '; $html .= '' . __( 'PCT', 'sports-bench' ) . ' | '; $html .= '|
---|---|---|---|---|---|---|
' . $team[ 'team_location' ] . ' | '; $html .= '' . $team[ 'wins' ] . ' | '; $html .= '' . $team[ 'draws' ] . ' | '; $html .= '' . $team[ 'losses' ] . ' | '; if ( $team[ 'games_back' ] == 0 ) { $html .= '' . '—' . ' | '; } else { $html .= '' . $team[ 'games_back' ] . ' | '; } $html .= '' . $team[ 'win_percentage' ] . ' | '; $html .= '