apply_filters( 'sports_bench_schedule_table', $html, $schedule, $team_id )

Type

Filters

Section

Teams

Outputs the table for the team’s schedule

Parameters

  • $html, string, the current HTML for the table
  • $schedule, array, the schedule for the team
  • $team_id, integer, the team id for the team

Returns

  • string, the HTML for the schedule table

Since: 1.5

Source: team-functions.php, line 150

Example

/**
 * Returns the html for the schedule table for a team
 *
 * @param string $html
 *
 * @param array $schedule
 *
 * @param int $team_id
 *
 * @return string, html for the schedule table
 *
 * @since 1.5
 */
function sports_bench_do_schedule_table( $html, $schedule, $team_id ) {
	$html .= '';
	$html .= '';
	$table_head_styles = apply_filters( 'sports_bench_team_schedule_head_row', '', $team_id );
	$html .= '';
	$html .= '';
	$html .= '';
	$html .= '';
	$html .= '';
	$html .= '';
	$html .= '';
	$html .= '';
	$html .= '';
	foreach ( $schedule as $game ) {
		$opponent = new Sports_Bench_Team( (int)$game[ 'opponent' ] );
		if ( $game[ 'neutral_site' ] == 0 ) {
			if ( $game[ 'location' ] == 'away' ) {
				$location = __( 'at ', 'sports-bench' );
			} else {
				$location = '';
			}
		} else {
			$location = 'vs. ';
		}
		$date = strtotime( $game[ 'date' ] );
		if ( $game[ 'team_score' ] != null and $game[ 'opponent_score' ] != null ) {
			$result = $game[ 'result' ] . ' ' . $game[ 'team_score' ] . '–' . $game[ 'opponent_score' ];
		} else {
			$result = '';
		}
		if ( $game[ 'recap' ] ) {
			$recap = '' . __( 'Recap', 'sports-bench' ) . '';
		} else {
			$recap = '';
		}
		$table_row_styles = apply_filters( 'sports_bench_team_schedule_game_row', '', $team_id, $opponent );
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
		$html .= '';
	}
	$html .= '';
	$html .= '
' . __( 'Date', 'sports-bench' ) . '' . __( 'Score', 'sports-bench' ) . '
' . $opponent->get_team_photo( 'team-logo' ) . '' . $location . $opponent->team_location . '' . date( 'M j', $date ) . '' . $result . '' . $recap . '
'; return $html; } add_filter( 'sports_bench_schedule_table', 'sports_bench_do_schedule_table', 10, 3 );