Customizing the team information areas
Level
Intermediate
Section
Plugin
Teams
Team Page
The first location for team information is the team page. If you’re using the Sports Bench theme or are using the team page shortcode to power the page, this section appears in the lower right side of the page. To change this information, you’ll need to use thesports_bench_team_info
filter accomplish your goal. Here’s the default for that section. You can use it as a guide for your custom filter function.
function sports_bench_do_team_info( $html, $team ) { $html .= '<div class="right">'; $html .= $team->get_team_photo( 'team-logo' ); $html .= '</div>'; $html .= '<p>'; $html .= __( 'Location', 'sports-bench' ) . ': ' . $team->team_city . ', ' . $team->team_state . '<br />'; $html .= __( 'Stadium', 'sports-bench' ) . ': ' . $team->team_stadium . '<br />'; $html .= __( 'Head Coach', 'sports-bench' ) . ': ' . $team->team_head_coach . '<br />'; $html .= '</p>'; return $html; } add_filter( 'sports_bench_team_info', 'sports_bench_do_team_info', 10, 2 );You can remove this default filter by running
remove_filter( 'sports_bench_team_info', 'sports_bench_do_team_info' );
.
Team Listing Page
The other location is the team listing page. This is the page where all of the teams are listed and you can click on them to enter their respective team pages. Fortunately, the process for adding your own custom filter here is essentially the same as the team information section. The only difference is that we’re using the sports_bench_team_listing_info filter. So, the default filter for that section looks like this:function sports_bench_do_team_listing_info( $html, $team_id, $team_name, $num_teams, $count ) { $current_team = new Sports_Bench_Team( (int)$team_id ); if ( $count % 2 == 0 ) { $html .= '<div class="row sports-bench-row">'; } $html .= apply_filters( 'sports_bench_before_team_listing', '', $current_team ); $html .= '<div class="large-6 medium-6 small-12 columns">'; $html .= '<a href="' . $current_team->get_permalink() . '">'; $html .= '<div class="team-info clearfix">'; $html .= '<h4 class="team-name">' . $team_name . '</h4>'; $html .= '<div class="right">'; $html .= $current_team->get_team_photo( 'team-logo' ); $html .= '</div>'; $html .= '<p>'; $html .= $current_team->get_division_name() . '<br />'; $html .= __( 'Location', 'sports-bench' ) . ': ' . $current_team->team_city . ', ' . $current_team->team_state . '<br />'; $html .= __( 'Stadium', 'sports-bench' ) . ': ' . $current_team->team_stadium . '<br />'; $html .= __( 'Head Coach', 'sports-bench' ) . ': ' . $current_team->team_head_coach . '<br />'; $html .= '</p>'; $html .= '</div>'; $html .= '</a>'; $html .= '</div>'; $html .= apply_filters( 'sports_bench_after_team_listing', '', $current_team ); if ( ( $count % 2 == 1 ) or ( $count == $num_teams - 1 ) ) { $html .= '</div>'; } $count++; return $html; } add_filter( 'sports_bench_team_listing_info', 'sports_bench_do_team_listing_info', 10, 5 );