apply_filters( 'sports_bench_player_shortcode_information', $html, $team, $team_id )

Type

Filters

Section

Players
Shortcodes

Outputs the HTML for the player information section of the player shortcode

Parameters

  • $html, string, the current HTML for the player information section
  • $player, Sports_Bench_Player object, the player object for the selected player
  • $team_id, integer, the team id for the team the player is on

Returns

  • string, the HTML to be outputted for the player information section of the player shortcode

Since: 1.5

Source: shortcodes.php, line 99

Example

/**
 * Returns the HTML for the player shortcode information section
 *
 * @param string $html
 *
 * @param Sports_Bench_Player $player
 *
 * @param Sports_Bench_Team $team
 *
 * @return string, html for the player shortcode information section
 */
function sports_bench_do_player_shortcode_information( $html, $player, $team ) {
    if ( 0 < $team ) {
        $team = new Sports_Bench_Team( (int)$team );
    } else {
        $team = 0;
    }
	$html .= '
'; if ( $player->get_player_photo() ) { $html .= '
'; $html .= $player->get_player_photo(); $html .= '
'; } else { $html .= '
'; $html .= 'mystery-person'; $html .= '
'; } $html .= '
'; $html .= '
'; $html .= '

' . $player->player_first_name . ' ' . $player->player_last_name . '

'; if ( '' !== $player->player_home_city && '' !== $player->player_home_state ) { $html .= '

' . $player->player_home_city . ', ' . $player->player_home_state . '

'; } elseif ( '' !== $player->player_home_city ) { $html .= '

' . $player->player_home_city . '

'; } elseif ( '' !== $player->player_home_state ) { $html .= '

' . $player->player_home_state . '

'; } if ( 0 !== $team ) { $html .= '

' . $team->team_name . '

'; } if ( '' !== $player->get_age() ) { $html .= '

' . __( 'Age: ', 'sports-bench' ) . $player->get_age() . '

'; } $html .= '

' . __( 'Seasons Played: ', 'sports-bench' ) . $player->get_seasons_played() . '

'; $html .= '
'; return $html; } add_filter( 'sports_bench_player_shortcode_information', 'sports_bench_do_player_shortcode_information', 10, 3 );