apply_filters( 'sports_bench_team_shortcode_upcoming_games', $html, $team, $schedule )

Type

Filters

Section

Shortcodes
Teams

Outputs the HTML for the upcoming games section of the team shortcode

Parameters

  • $html, string, the current HTML for before the upcoming games section
  • $team, Sports_Bench_Team object, the team object for the selected team
  • $schedule, array, the upcoming schedule of games for a team

Returns

  • string, the HTML to be outputted for the upcoming games section of the team shortcode

Since: 1.5

Source: shortcodes.php, line 68

Example

/**
 * Returns the html for the upcoming games table in the team shortcode
 *
 * @param string $html
 *
 * @param Sports_Bench_Team $team
 *
 * @param array $schedule
 *
 * @return string, html for the upcoming games table
 *
 * @since 1.5
 */
function sports_bench_do_team_shortcode_upcoming_games( $html, $team, $schedule ) {
	$html .= '';
	$html .= '';
	$table_head_styles = apply_filters( 'sports_bench_team_shortcode_upcoming_head_row', '', $team );
	$html .= '';
	$html .= '';
	$html .= '';
	$html .= '';
	$html .= '';
	$html .= '';
	foreach ( $schedule as $game ) {
		$opponent = new Sports_Bench_Team( (int)$game[ 'opponent' ] );
		if ( $game[ 'location' ] == 'away' ) { $location = __( 'at ', 'sports-bench' ); } else $location = '';
		$date = strtotime( $game[ 'date' ] );
		$table_row_styles = apply_filters( 'sports_bench_team_shortcode_upcoming_row', '', $team );
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
	}
	$html .= '';
	$html .= '
' . __( 'Upcoming Games', 'sports-bench' ) . '' . __( 'Date', 'sports-bench' ) . '
' . $opponent->get_team_photo( 'team-logo' ) . '' . $location . $opponent->team_location . '' . date( 'g:i a, M j', $date ) . '
'; return $html; } add_filter( 'sports_bench_team_shortcode_upcoming_games', 'sports_bench_do_team_shortcode_upcoming_games', 10, 3 );