apply_filters( 'sports_bench_scoreboard_bar_game', $html, $game )

Type

Filters

Section

Scoreboard

Outputs the HTML for a game in the scoreboard bar

Parameters

  • $html, string, the current HTML for the game
  • $game, Sports_Bench_Game object, the game object for the current game

Returns

  • string, the HTML for the game in the scoreboard bar

Since: 1.5

Source: scoreboard.php, line 75

Example

function sports_bench_do_scoreboard_bar_game( $html, $game ) {

	$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;
	if ( $status == 'in_progress' ) {
		$away_score = $game->game_current_away_score;
		$home_score = $game->game_current_home_score;
		$datetime   = '';
		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;
		$datetime     = '';
		$time_in_game = 'FINAL';
	} else {
		$away_score   = '';
		$home_score   = '';
		$time_in_game = '';
		$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' );
		}
	}

	$html .= apply_filters( 'sports_bench_before_scoreboard_bar_game', '', $game->game_id, $away_team, $home_team );

	$html .= '
'; $html .= ''; $away_row_style = apply_filters( 'sports_bench_scoreboard_bar_row_styles', '', $away_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $home_row_style = apply_filters( 'sports_bench_scoreboard_bar_row_styles', '', $home_team ); $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= ''; $html .= '
' . $away_team->get_team_photo( 'team-logo' ) . '' . $away_team->team_location . '' . $away_score . '
' . $home_team->get_team_photo( 'team-logo' ) . '' . $home_team->team_location . '' . $home_score . '
' . $datetime . $time_in_game . '
'; if ( $game->game_recap != null and $game->game_status == 'final' ) { $html .= ''; } elseif ( $game->game_preview != null and $game->game_status == 'scheduled' ) { $html .= ''; } else { } $html .= '
'; $html .= apply_filters( 'sports_bench_after_scoreboard_bar_game', '', $game->game_id, $away_team, $home_team ); return $html; } add_filter( 'sports_bench_scoreboard_bar_game', 'sports_bench_do_scoreboard_bar_game', 10, 2 );