apply_filters( 'sports_bench_player_information', $html, $player, $team )

Type

Filters

Section

Players

Outputs the HTML for the player information on the player page

Parameters

  • $html, string, current HTML being outputted
  • $player, Sports_Bench_Player object, the player object for the current player
  • $team, Sports_Bench_Team object, the team object for the player's team

Returns

  • string, the HTML for the player listing

Since: 1.5

Source: player-functions.php, line 110

Example

/**
 * Returns the HTML for the player information section of the player page
 *
 * @param $html, current html for the player information section
 *
 * @param $player, the Player Class for the player
 *
 * @param $team, the Team Class for the player's team
 *
 * @return string, html for the player information section
 *
 * @since 1.5
 */
function sports_bench_player_information_section( $html, $player, $team ) {
    $html .= '
'; $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 . '

'; $html .= '

' . $player->player_position . '

'; $html .= '

' . $team->team_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 ( '' !== $player->get_age() ) { $html .= '

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

'; } if ( '' !== $player->player_height && 0 < $player->player_weight ) { $html .= '

' . stripslashes( $player->player_height ) . ' | ' . $player->player_weight . '

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

' . stripslashes( $player->player_height ) . '

'; } elseif ( 0 < $player->player_weight ) { $html .= '

' . $player->player_weight . '

'; } $html .= '

' . $player->get_years() . '

'; $html .= '
' . $player->player_id . '
'; $html .= '
'; $html .= '
'; return $html; } remove_filter( 'sports_bench_player_information', 'sports_bench_do_player_information' ); add_filter( 'sports_bench_player_information', 'sports_bench_player_information_section', 10, 3 );