Created
January 14, 2019 02:46
-
-
Save JMWebDevelopment/d1f986fcd321b05b95fdd267890d4d14 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sports_bench_do_playoff_series_modal( $html, $series, $team_one, $team_one_name, $team_two, $team_two_name, $game_numbers ) { | |
$html .= '<div class="reveal sports-bench-playoff-modal" id="series-' . $series->series_id . '" data-reveal>'; | |
$html .= '<table class="series-modal-top">'; | |
$html .= '<tr>'; | |
$html .= '<td class="modal-logo">' . $team_one->get_team_photo( 'team-logo' ) . '</td>'; | |
$html .= '<td class="modal-team-name team-one-name">' . $team_one_name . '</td>'; | |
$html .= '<td class="modal-score">' . $series->get_series_score() . '</td>'; | |
$html .= '<td class="modal-team-name team-two-name">' . $team_two_name . '</td>'; | |
$html .= '<td class="modal-logo">' . $team_two->get_team_photo( 'team-logo' ) . '</td>'; | |
$html .= '</tr>'; | |
$html .= '</table>'; | |
$html .= '<table class="series-modal-bottom">'; | |
$games = $series->game_ids; | |
$games = explode( ', ', $games ); | |
$k = 0; | |
if ( ! empty( $games ) ) { | |
foreach ( $games as $game ) { | |
$the_game = new Sports_Bench_Game( (int) $game ); | |
$home = new Sports_Bench_Team( (int) $the_game->game_home_id ); | |
$away = new Sports_Bench_Team( (int) $the_game->game_away_id ); | |
if ( $the_game->game_home_final > $the_game->game_away_final ) { | |
$scoreline = $home->team_location . ' ' . $the_game->game_home_final . ', ' . $away->team_location . ' ' . $the_game->game_away_final; | |
} else { | |
$scoreline = $away->team_location . ' ' . $the_game->game_away_final . ', ' . $home->team_location . ' ' . $the_game->game_home_final; | |
} | |
if ( $game != 0 && $the_game->game_status == 'final' ) { | |
$html .= '<tr>'; | |
if ( $series->series_format == 'single-game' ) { | |
} else { | |
$html .= '<td class="modal-game-number">' . $game_numbers[ $k ] . '</td>'; | |
} | |
$html .= '<td class="modal-game-score">' . $scoreline . '</td>'; | |
if ( $the_game->recap_link ) { | |
$html .= '<td class="modal-game-recap"><a href="' . $the_game->recap_link . '">' . __( 'Recap', 'sports-bench' ) . '</a></td>'; | |
} else { | |
$html .= '<td></td>'; | |
} | |
$html .= '</tr>'; | |
$k += 1; | |
} | |
} | |
} | |
$html .= '</table>'; | |
$html .= '<button class="close-button" data-close aria-label="Close modal" type="button">'; | |
$html .= '<span aria-hidden="true">×</span>'; | |
$html .= '</button>'; | |
$html .= '</div>'; | |
return $html; | |
} | |
add_filter( 'sports_bench_playoff_series_modal', 'sports_bench_do_playoff_series_modal', 10, 7 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment