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

Type

Filters

Section

Shortcodes
Teams

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

Parameters

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

Returns

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

Since: 1.5

Source: shortcodes.php, line 64

Example

/**
 * Returns the html for the recent games table in the team shortcode
 *
 * @param string $html
 *
 * @param Sports_Bench_Team $team
 *
 * @param array $schedule
 *
 * @return string, html for the recent games table
 *
 * @since 1.5
 */
function sports_bench_do_team_shortcode_recent_games( $html, $team, $schedule ) {
	$html .= '';
	$html .= '';
	$table_head_styles = apply_filters( 'sports_bench_team_shortcode_recent_head_row', '', $team );
	$html .= '';
	$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 = '';
		if ( $game[ 'team_score' ] != null and $game[ 'opponent_score' ] != null ) { $score = $game[ 'result' ] . ' ' . $game[ 'team_score' ] . '–' . $game[ 'opponent_score' ]; } else { $score = ''; }
		if ( $game[ 'recap' ] ) { $recap = '' . __( 'Recap', 'sports-bench' ) . ''; } else { $recap = ''; }
		$table_row_styles = apply_filters( 'sports_bench_team_shortcode_recent_row', '', $team );
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
	}
	$html .= '';
	$html .= '
' . __( 'Recent Results', 'sports-bench' ) . '' . __( 'Score', 'sports-bench' ) . '
' . $opponent->get_team_photo( 'team-logo' ) . '' . $location . $opponent->team_location . '' . $score . '' . $recap . '
'; return $html; } add_filter( 'sports_bench_team_shortcode_recent_games', 'sports_bench_do_team_shortcode_recent_games', 10, 3 );