Skip to content

Instantly share code, notes, and snippets.

@JMWebDevelopment
Created April 20, 2018 21:52
Show Gist options
  • Save JMWebDevelopment/d08a959fd8a8aba40207baee1883451e to your computer and use it in GitHub Desktop.
Save JMWebDevelopment/d08a959fd8a8aba40207baee1883451e to your computer and use it in GitHub Desktop.
function sports_bench_render_team( $attributes ) {
$team_id = $attributes[ 'team_id' ];
$html = '';
if ( $team_id > 0 ) {
$team = new Sports_Bench_Team( (int)$team_id );
$record = $team->get_record( '"' . get_option( 'sports-bench-season-year' ) . '"' );
$html .= '<div id="sports-bench-team-' . $team->team_id . '" class="sports-bench-shortcode-team row">';
$html .= apply_filters( 'sports_bench_before_team_shortcode', '', $team );
$html .= '<div class="row sports-bench-row">';
$html .= apply_filters( 'sports_bench_team_shortcode_information', '', $team, $record );
$html .= '</div>';
$html .= '<div class="row sports-bench-row">';
$html .= '<div id="recent-schedule" class="large-6 medium-6 small-12 columns">';
$schedule = $team->get_recent_results( 5, '"' . get_option( 'sports-bench-season-year' ) . '"' );
$html .= apply_filters( 'sports_bench_team_shortcode_recent_games', '', $team, $schedule );
$html .= '</div>';
$html .= '<div id="upcoming-schedule" class="large-6 medium-6 small-12 columns">';
$schedule = $team->get_upcoming_schedule( 5, '"' . get_option( 'sports-bench-season-year' ) . '"' );
$html .= apply_filters( 'sports_bench_team_shortcode_upcoming_games', '', $team, $schedule );
$html .= '</div>';
$html .= '</div>';
$html .= apply_filters( 'sports_bench_after_team_shortcode', '', $team );
$html .= '</div>';
}
return $html;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment