Add short name setting to teams and automate display

This commit is contained in:
Brian Miyaji
2018-05-02 12:52:01 +10:00
parent 4b6d23895b
commit bc57f39eba
18 changed files with 44 additions and 50 deletions

View File

@@ -30,7 +30,6 @@ $defaults = array(
'link_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
'link_venues' => get_option( 'sportspress_link_venues', 'yes' ) == 'yes' ? true : false,
'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
@@ -199,7 +198,7 @@ $identifier = uniqid( 'eventlist_' );
if ( $teams ):
foreach ( $teams as $t => $team ):
$name = sp_get_team_name( $team, $abbreviate_teams );
$name = sp_team_short_name( $team );
if ( $name ):
$name = '<meta itemprop="name" content="' . $name . '">' . $name;

View File

@@ -27,9 +27,9 @@
if ( $show_team_names ) {
if ( $j % 2 ) {
$logo .= ' <strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong>';
$logo .= ' <strong class="sp-team-name">' . sp_team_short_name( $team ) . '</strong>';
} else {
$logo = '<strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong> ' . $logo;
$logo = '<strong class="sp-team-name">' . sp_team_short_name( $team ) . '</strong> ' . $logo;
}
}

View File

@@ -21,9 +21,9 @@ foreach ( $teams as $team ):
// Add team name
if ( $show_team_names ) {
if ( $alt ) {
$logo .= ' <strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong>';
$logo .= ' <strong class="sp-team-name">' . sp_team_short_name( $team ) . '</strong>';
} else {
$logo = '<strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong> ' . $logo;
$logo = '<strong class="sp-team-name">' . sp_team_short_name( $team ) . '</strong> ' . $logo;
}
}

View File

@@ -23,7 +23,6 @@ $layout = get_option( 'sportspress_event_logos_format', 'inline' );
$show_team_names = get_option( 'sportspress_event_logos_show_team_names', 'yes' ) === 'yes' ? true : false;
$show_time = get_option( 'sportspress_event_logos_show_time', 'no' ) === 'yes' ? true : false;
$show_results = get_option( 'sportspress_event_logos_show_results', 'no' ) === 'yes' ? true : false;
$abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
$link_teams = get_option( 'sportspress_link_teams', 'no' ) === 'yes' ? true : false;
if ( $show_results ) {
@@ -44,7 +43,6 @@ sp_get_template( 'event-logos-' . $layout . '.php', array(
'show_team_names' => $show_team_names,
'show_time' => $show_time,
'show_results' => $show_results,
'abbreviate_teams' => $abbreviate_teams,
'link_teams' => $link_teams,
) );

View File

@@ -16,7 +16,6 @@ $show_numbers = get_option( 'sportspress_event_show_player_numbers', 'yes' ) ===
$show_position = get_option( 'sportspress_event_show_position', 'yes' ) === 'yes' ? true : false;
$show_minutes = get_option( 'sportspress_event_performance_show_minutes', 'no' ) === 'yes' ? true : false;
$sections = get_option( 'sportspress_event_performance_sections', -1 );
$abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
$reverse_teams = get_option( 'sportspress_event_reverse_teams', 'no' ) === 'yes' ? true : false;
$primary = sp_get_main_performance_option();
$total = get_option( 'sportspress_event_total_performance', 'all');
@@ -226,7 +225,7 @@ if ( is_array( $teams ) ):
'show_numbers' => $show_numbers,
'show_minutes' => $show_minutes,
'show_total' => $show_total,
'caption' => 0 == $s && $team_id ? sp_get_team_name( $team_id, $abbreviate_teams ) : null,
'caption' => 0 == $s && $team_id ? sp_team_short_name( $team_id ) : null,
'labels' => $labels[ $section_id ],
'formats' => $formats,
'mode' => $mode,
@@ -263,7 +262,7 @@ if ( is_array( $teams ) ):
'show_numbers' => $show_numbers,
'show_minutes' => $show_minutes,
'show_total' => $show_total,
'caption' => $team_id ? sp_get_team_name( $team_id, $abbreviate_teams ) : null,
'caption' => $team_id ? sp_team_short_name( $team_id ) : null,
'labels' => $labels,
'formats' => $formats,
'mode' => $mode,

View File

@@ -36,7 +36,6 @@ if ( empty( $data ) )
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
$link_teams = get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false;
$abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
$show_outcomes = array_key_exists( 'outcome', $labels );
// Initialize
@@ -64,7 +63,7 @@ foreach( $data as $team_id => $result ):
$table_rows .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
$team_name = sp_get_team_name( $team_id, $abbreviate_teams );
$team_name = sp_team_short_name( $team_id );
if ( $link_teams && sp_post_exists( $team_id ) ):
$team_name = '<a href="' . get_post_permalink( $team_id ) . '">' . $team_name . '</a>';

View File

@@ -23,7 +23,6 @@ $defaults = array(
'show_leagues' => get_option( 'sportspress_official_show_leagues', 'no' ) == 'yes' ? true : false,
'show_seasons' => get_option( 'sportspress_official_show_seasons', 'no' ) == 'yes' ? true : false,
'show_nationality_flags' => get_option( 'sportspress_official_show_flags', 'yes' ) == 'yes' ? true : false,
'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
);
@@ -76,7 +75,7 @@ if ( $show_current_teams ):
if ( $current_teams ):
$teams = array();
foreach ( $current_teams as $team ):
$team_name = sp_get_team_name( $team, $abbreviate_teams );
$team_name = sp_team_short_name( $team );
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
$teams[] = $team_name;
endforeach;
@@ -89,7 +88,7 @@ if ( $show_past_teams ):
if ( $past_teams ):
$teams = array();
foreach ( $past_teams as $team ):
$team_name = sp_get_team_name( $team, $abbreviate_teams );
$team_name = sp_team_short_name( $team );
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
$teams[] = $team_name;
endforeach;

View File

@@ -23,7 +23,6 @@ $defaults = array(
'show_leagues' => get_option( 'sportspress_player_show_leagues', 'no' ) == 'yes' ? true : false,
'show_seasons' => get_option( 'sportspress_player_show_seasons', 'no' ) == 'yes' ? true : false,
'show_nationality_flags' => get_option( 'sportspress_player_show_flags', 'yes' ) == 'yes' ? true : false,
'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
);
@@ -76,7 +75,7 @@ if ( $show_current_teams ):
if ( $current_teams ):
$teams = array();
foreach ( $current_teams as $team ):
$team_name = sp_get_team_name( $team, $abbreviate_teams );
$team_name = sp_team_short_name( $team );
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
$teams[] = $team_name;
endforeach;
@@ -89,7 +88,7 @@ if ( $show_past_teams ):
if ( $past_teams ):
$teams = array();
foreach ( $past_teams as $team ):
$team_name = sp_get_team_name( $team, $abbreviate_teams );
$team_name = sp_team_short_name( $team );
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
$teams[] = $team_name;
endforeach;

View File

@@ -24,7 +24,6 @@ $defaults = array(
'show_player_flag' => get_option( 'sportspress_list_show_flags', 'no' ) == 'yes' ? true : false,
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
@@ -173,7 +172,7 @@ foreach ( $groups as $group ):
if ( array_key_exists( 'team', $labels ) ):
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_current_team', true ) );
$team_name = sp_get_team_name( $team, $abbreviate_teams );
$team_name = sp_team_short_name( $team );
if ( $link_teams && false !== get_post_status( $team ) ):
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
endif;

View File

@@ -19,7 +19,6 @@ $defaults = array(
'show_past_teams' => get_option( 'sportspress_staff_show_past_teams', 'yes' ) == 'yes' ? true : false,
'show_nationality_flags' => get_option( 'sportspress_staff_show_flags', 'yes' ) == 'yes' ? true : false,
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
'abbreviate_teams' => get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false,
);
extract( $defaults, EXTR_SKIP );
@@ -50,7 +49,7 @@ endif;
if ( $show_current_teams && $current_teams ):
$teams = array();
foreach ( $current_teams as $team ):
$team_name = sp_get_team_name( $team, $abbreviate_teams );
$team_name = sp_team_short_name( $team );
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
$teams[] = $team_name;
endforeach;
@@ -60,7 +59,7 @@ endif;
if ( $show_past_teams && $past_teams ):
$teams = array();
foreach ( $past_teams as $team ):
$team_name = sp_get_team_name( $team, $abbreviate_teams );
$team_name = sp_team_short_name( $team );
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
$teams[] = $team_name;
endforeach;