apply_filters( 'sports_bench_scoreboard_game', $html, $game, $count, $num_games )
Type
Filters
Section
Scoreboard
Outputs the HTML for a game in the scoreboard
Parameters
- $html, string, the current HTML for the game
- $game, Sports_Bench_Game object, the game object for the current game
- $count, integer, the current count of games being looped through
- $num_games, integer, the total number of games
Returns
- string, the HTML for the game in the scoreboard
Since: 1.5
Source: scoreboard.php, line 219, 407
Example
/** * Returns the HTML for a game in the scoreboard * * @param $html, current html for the game * * @param $game, the Game Class for the game * * @param $count, the current count of games * * @param $num_games, the total number of games being shown * * @return string, html for a game * * @since 1.5 */ function sports_bench_theme_scoreboard_game( $html, $game, $count, $num_games ) { $theme = wp_get_theme(); $parent_theme = $theme->get( 'Template' ); $game_id = $game->game_id; $away_team = new Sports_Bench_Team( (int) $game->game_away_id ); $home_team = new Sports_Bench_Team( (int) $game->game_home_id ); $status = $game->game_status; $date = date_create( $game->game_day ); if ( sports_bench_is_game_time_set( $date ) === true ) { $datetime = date_format( $date, 'g:i a, F j' ); } else { $datetime = date_format( $date, 'F j' ); } if ( $status == 'in_progress' ) { $away_score = $game->game_current_away_score; $home_score = $game->game_current_home_score; if ( $game->game_current_period != null and $game->game_current_time != null ) { $sep = ' | '; } else { $sep = ''; } $period = $game->game_current_period; $time = stripslashes( $game->game_current_time ); $time_in_game = $time . $sep . $period; } elseif ( $status == 'final' ) { $away_score = $game->game_away_final; $home_score = $game->game_home_final; $time_in_game = __( 'Final', 'sports-bench' ); $time = ''; $period = ''; } else { $away_score = ''; $home_score = ''; $time_in_game = __( 'Pregame', 'sports-bench' ); $time = ''; $period = ''; } $id = 'game-' . $game_id; if ( 0 == $count ) { $html .= ''; } $html .= apply_filters( 'sports_bench_before_scoreboard_game', '', $game_id, $away_team, $home_team ); $html .= ''; } return $html; } remove_filter( 'sports_bench_scoreboard_game', 'sports_bench_do_scoreboard_game' ); add_filter( 'sports_bench_scoreboard_game', 'sports_bench_theme_scoreboard_game', 10, 4 );'; $html .= ''; $html .= apply_filters( 'sports_bench_scoreboard_modal', '', $game, $away_team, $home_team, $status, $time, $period ); $html .= apply_filters( 'sports_bench_after_scoreboard_game', '', $game_id, $away_team, $home_team ); if ( $num_games - 1 == $count ) { $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
'; $html .= ''; $html .= ' '; $away_row_style = apply_filters( 'sports_bench_scoreboard_row_styles', '', $away_team, 'scoreboard' ); $html .= '' . $datetime .' '; $html .= ''; $html .= ' '; $home_row_style = apply_filters( 'sports_bench_scoreboard_row_styles', '', $home_team, 'scoreboard' ); $html .= '' . $away_team->get_team_photo( 'team-logo' ) . ' '; $html .= '' . $away_team->team_location . ' '; $html .= '' . $away_score . ' '; $html .= ''; $html .= ' '; $html .= '' . $home_team->get_team_photo( 'team-logo' ) . ' '; $html .= '' . $home_team->team_location . ' '; $html .= '' . $home_score . ' '; $html .= ''; $html .= ' '; $html .= '' . $time_in_game . ' '; $html .= ''; $html .= ' '; $html .= ''; if ( $game->game_preview != null && ( $game->game_status == 'scheduled' || $game->game_status == 'in_progress' ) ) { $html .= ' '; $html .= '' . __( 'PREVIEW', 'sports-bench' ) . '
'; } if ( $game->game_status == 'in_progress' && ( $theme->name != 'Sports Bench' || ( $parent_theme && $parent_theme->name != 'Sports Bench' ) ) ) { $html .= '' . __( 'LIVE', 'sports-bench' ) . '
'; } if ( $game->game_recap != null && $game->game_status == 'final' ) { $html .= '' . __( 'PREVIEW', 'sports-bench' ) . '
'; $html .= '' . __( 'RECAP', 'sports-bench' ) . '
'; } $html .= '