Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save JMWebDevelopment/1cc8fbbd6cfc6ec166e86c3257129910 to your computer and use it in GitHub Desktop.
Save JMWebDevelopment/1cc8fbbd6cfc6ec166e86c3257129910 to your computer and use it in GitHub Desktop.
function sports_bench_do_game_modal( $html, $game, $away_team, $home_team, $status, $time, $period ) {
$theme = wp_get_theme();
$parent_theme = $theme->parent();
if ( $status == 'in_progress' && ( $theme->name != 'Sports Bench' || ( $parent_theme && $parent_theme->name != 'Sports Bench' ) ) ) {
if ( $game->game_current_period != null and $game->game_current_time != null ) {
$time_in_game = '<span class="time">' . $time . '</span><br /><span class="period">' . $period . '</span>';
} else {
$time_in_game = '<span class="time">' . $time . '</span>';
}
if ( $away_team->team_nickname != null ) {
$away_team_name = '<span class="team-location">' . $away_team->team_location . '</span><br /><span class="team-nickname">' . $away_team->team_nickname . '</span>';
} else {
$away_team_name = $away_team->team_location;
}
if ( $home_team->team_nickname != null ) {
$home_team_name = '<span class="team-location">' . $home_team->team_location . '</span><br /><span class="team-nickname">' . $home_team->team_nickname . '</span>';
} else {
$home_team_name = $home_team->team_location;
}
$away_score = $game->game_current_away_score;
$home_score = $game->game_current_home_score;
$id = 'game-' . $game->game_id;
$game_id = $game->game_id;
$html .= '<div class="reveal sports-bench-game-modal" id="game-modal-' . $id . '" data-reveal>';
$html .= '<div class="game-modal-inner">';
$html .= '<table class="game-modal-table">';
$html .= '<tr>';
$html .= '<td class="team-logo left">' . $away_team->get_team_photo( 'team-logo' ) . '</td>';
$html .= '<td class="left team-name">' . $away_team_name . '</td>';
$html .= '<td id="modal-away-score" class="left">' . $away_score . '</td>';
$html .= '<td class="center time-period">' . $time_in_game . '</td>';
$html .= '<td id="modal-home-score" class="right">' . $home_score . '</td>';
$html .= '<td class="right team-name">' . $home_team_name . '</td>';
$html .= '<td class="team-logo right">' . $home_team->get_team_photo( 'team-logo' ) . '</td>';
$html .= '</tr>';
$html .= '</table>';
$html .= sports_bench_get_linescore_display( $game_id );
if ( get_option( 'sports-bench-sport' ) != 'basketball' ) {
$html .= '<h3 class="modal-heading">' . __( 'Game Events', 'sports-bench' ) . '</h3>';
$html .= sports_bench_get_score_info( $game_id );
}
$html .= '</div>';
$html .= '<button class="close-button" data-close aria-label="Close modal" type="button">';
$html .= '<span aria-hidden="true">&times;</span>';
$html .= '</button>';
$html .= '</div>';
}
return $html;
}
add_filter( 'sports_bench_scoreboard_modal', 'sports_bench_do_game_modal', 10, 7 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment