diff --git a/includes/admin/post-types/class-sp-admin-cpt-event.php b/includes/admin/post-types/class-sp-admin-cpt-event.php
index 6c85a845..bae9b5d8 100644
--- a/includes/admin/post-types/class-sp-admin-cpt-event.php
+++ b/includes/admin/post-types/class-sp-admin-cpt-event.php
@@ -97,7 +97,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT {
while ( is_array( $team ) ) {
$team = array_shift( array_filter( $team ) );
}
- if ( $team > 0 ) $team_names[] = sp_get_short_name( $team );
+ if ( $team > 0 ) $team_names[] = sp_team_short_name( $team );
endforeach;
$team_names = array_unique( $team_names );
diff --git a/includes/admin/post-types/class-sp-admin-cpt-team.php b/includes/admin/post-types/class-sp-admin-cpt-team.php
index d7ba0d9a..3a4f2f3a 100644
--- a/includes/admin/post-types/class-sp-admin-cpt-team.php
+++ b/includes/admin/post-types/class-sp-admin-cpt-team.php
@@ -62,7 +62,7 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT {
'cb' => '',
'sp_icon' => '',
'title' => null,
- 'sp_url' => __( 'URL', 'sportspress' ),
+ 'sp_short_name' => __( 'Short Name', 'sportspress' ),
'sp_abbreviation' => __( 'Abbreviation', 'sportspress' ),
'sp_league' => __( 'Leagues', 'sportspress' ),
'sp_season' => __( 'Seasons', 'sportspress' ),
@@ -81,8 +81,9 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT {
case 'sp_icon':
echo has_post_thumbnail( $post_id ) ? edit_post_link( get_the_post_thumbnail( $post_id, 'sportspress-fit-mini' ), '', '', $post_id ) : '';
break;
- case 'sp_url':
- echo strip_tags( sp_get_url( $post_id ), '' );
+ case 'sp_short_name':
+ $short_name = get_post_meta ( $post_id, 'sp_short_name', true );
+ echo $short_name ? esc_html( $short_name ) : '—';
break;
case 'sp_abbreviation':
$abbreviation = get_post_meta ( $post_id, 'sp_abbreviation', true );
diff --git a/includes/admin/settings/class-sp-settings-teams.php b/includes/admin/settings/class-sp-settings-teams.php
index 024ac6b6..9041c13c 100644
--- a/includes/admin/settings/class-sp-settings-teams.php
+++ b/includes/admin/settings/class-sp-settings-teams.php
@@ -58,13 +58,13 @@ class SP_Settings_Teams extends SP_Settings_Page {
'type' => 'checkbox',
),
- array(
- 'title' => __( 'Link', 'sportspress' ),
- 'desc' => __( 'Link teams', 'sportspress' ),
- 'id' => 'sportspress_link_teams',
- 'default' => 'no',
- 'type' => 'checkbox',
- ),
+ array(
+ 'title' => __( 'Link', 'sportspress' ),
+ 'desc' => __( 'Link teams', 'sportspress' ),
+ 'id' => 'sportspress_link_teams',
+ 'default' => 'no',
+ 'type' => 'checkbox',
+ ),
array(
'title' => __( 'Venue', 'sportspress' ),
@@ -74,14 +74,6 @@ class SP_Settings_Teams extends SP_Settings_Page {
'type' => 'checkbox',
),
- array(
- 'title' => __( 'Abbreviation', 'sportspress' ),
- 'desc' => __( 'Abbreviate team names', 'sportspress' ),
- 'id' => 'sportspress_abbreviate_teams',
- 'default' => 'yes',
- 'type' => 'checkbox',
- ),
-
array(
'title' => __( 'Visit Site', 'sportspress' ),
'desc' => __( 'Open link in a new window/tab', 'sportspress' ),
diff --git a/includes/class-sp-event.php b/includes/class-sp-event.php
index 86b04ac6..e22c21f8 100644
--- a/includes/class-sp-event.php
+++ b/includes/class-sp-event.php
@@ -393,7 +393,7 @@ class SP_Event extends SP_Custom_Post{
$stats[ $index ]['number'] = sp_array_value( $player_numbers, $details['id'] );
if ( 'team' === $details['key'] ) {
- $name = sp_get_team_name( $details['team'] );
+ $name = sp_team_short_name( $details['team'] );
$stats[ $index ]['name'] = $name;
$stats[ $index ]['label'] = $name;
$stats[ $index ]['icon'] = sp_get_logo( $details['team'] );
diff --git a/includes/class-sp-league-table.php b/includes/class-sp-league-table.php
index 34628f1b..fbc1ed32 100644
--- a/includes/class-sp-league-table.php
+++ b/includes/class-sp-league-table.php
@@ -38,7 +38,6 @@ class SP_League_Table extends SP_Secondary_Post {
$usecolumns = get_post_meta( $this->ID, 'sp_columns', true );
$adjustments = get_post_meta( $this->ID, 'sp_adjustments', true );
$select = get_post_meta( $this->ID, 'sp_select', true );
- $abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
$link_events = get_option( 'sportspress_link_events', 'yes' ) === 'yes' ? true : false;
$form_limit = (int) get_option( 'sportspress_form_limit', 5 );
@@ -702,7 +701,7 @@ class SP_League_Table extends SP_Secondary_Post {
// Add team name to row
$merged[ $team_id ] = array();
- $team_data['name'] = sp_get_team_name( $team_id, $abbreviate_teams );
+ $team_data['name'] = sp_team_short_name( $team_id );
foreach ( $team_data as $key => $value ):
diff --git a/includes/class-sp-player.php b/includes/class-sp-player.php
index 2fdd2366..58f1b421 100644
--- a/includes/class-sp-player.php
+++ b/includes/class-sp-player.php
@@ -115,7 +115,6 @@ class SP_Player extends SP_Custom_Post {
$metrics = (array)get_post_meta( $this->ID, 'sp_metrics', true );
$stats = (array)get_post_meta( $this->ID, 'sp_statistics', true );
$leagues = sp_array_value( (array)get_post_meta( $this->ID, 'sp_leagues', true ), $league_id, array() );
- $abbreviate_teams = get_option( 'sportspress_abbreviate_teams', 'yes' ) === 'yes' ? true : false;
$manual_columns = 'manual' == get_option( 'sportspress_player_columns', 'auto' ) ? true : false;
// Get performance labels
@@ -581,7 +580,7 @@ class SP_Player extends SP_Custom_Post {
$season_name = sp_array_value( $season_names, $season_id, ' ' );
if ( $team_id ):
- $team_name = sp_get_team_name( $team_id, $abbreviate_teams );
+ $team_name = sp_team_short_name( $team_id );
if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false ):
$team_permalink = get_permalink( $team_id );
diff --git a/includes/sp-api-functions.php b/includes/sp-api-functions.php
index 43d9d9fc..bec09a42 100644
--- a/includes/sp-api-functions.php
+++ b/includes/sp-api-functions.php
@@ -317,9 +317,11 @@ function sp_the_short_name( $post = 0 ) {
echo sp_team_short_name( $post );
}
-function sp_get_team_name( $post = 0, $short = true ) {
- if ( $short ) {
+function sp_team_name( $post = 0, $length = 'full' ) {
+ if ( 'abbreviation' == $length ) {
return sp_team_abbreviation( $post );
+ } elseif ( 'short' == $length ) {
+ return sp_team_short_name( $post );
} else {
return get_the_title( $post );
}
diff --git a/includes/sp-deprecated-functions.php b/includes/sp-deprecated-functions.php
index 4be806a3..9369f5d3 100644
--- a/includes/sp-deprecated-functions.php
+++ b/includes/sp-deprecated-functions.php
@@ -220,3 +220,13 @@ if ( !function_exists( 'sp_short_name' ) ) {
echo sp_get_short_name( $post );
}
}
+
+if ( !function_exists( 'sp_get_team_name' ) ) {
+ function sp_get_team_name( $post = 0, $short = true ) {
+ if ( $short ) {
+ return sp_team_abbreviation( $post );
+ } else {
+ return get_the_title( $post );
+ }
+ }
+}
diff --git a/templates/event-list.php b/templates/event-list.php
index 0ecb9df9..64d10040 100644
--- a/templates/event-list.php
+++ b/templates/event-list.php
@@ -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 = '' . $name;
diff --git a/templates/event-logos-block.php b/templates/event-logos-block.php
index 91a1f003..6c5f3429 100644
--- a/templates/event-logos-block.php
+++ b/templates/event-logos-block.php
@@ -27,9 +27,9 @@
if ( $show_team_names ) {
if ( $j % 2 ) {
- $logo .= ' ' . sp_get_team_name( $team, $abbreviate_teams ) . '';
+ $logo .= ' ' . sp_team_short_name( $team ) . '';
} else {
- $logo = '' . sp_get_team_name( $team, $abbreviate_teams ) . ' ' . $logo;
+ $logo = '' . sp_team_short_name( $team ) . ' ' . $logo;
}
}
diff --git a/templates/event-logos-inline.php b/templates/event-logos-inline.php
index cebe366b..b8e287ff 100644
--- a/templates/event-logos-inline.php
+++ b/templates/event-logos-inline.php
@@ -21,9 +21,9 @@ foreach ( $teams as $team ):
// Add team name
if ( $show_team_names ) {
if ( $alt ) {
- $logo .= ' ' . sp_get_team_name( $team, $abbreviate_teams ) . '';
+ $logo .= ' ' . sp_team_short_name( $team ) . '';
} else {
- $logo = '' . sp_get_team_name( $team, $abbreviate_teams ) . ' ' . $logo;
+ $logo = '' . sp_team_short_name( $team ) . ' ' . $logo;
}
}
diff --git a/templates/event-logos.php b/templates/event-logos.php
index 345af317..a6dcd416 100644
--- a/templates/event-logos.php
+++ b/templates/event-logos.php
@@ -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,
) );
diff --git a/templates/event-performance.php b/templates/event-performance.php
index 2d3eb267..cc730fc7 100644
--- a/templates/event-performance.php
+++ b/templates/event-performance.php
@@ -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,
diff --git a/templates/event-results.php b/templates/event-results.php
index 0795c49b..07dc2b7f 100644
--- a/templates/event-results.php
+++ b/templates/event-results.php
@@ -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 .= '';
- $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 = '' . $team_name . '';
diff --git a/templates/official-details.php b/templates/official-details.php
index 5b5f4e47..aac8654f 100644
--- a/templates/official-details.php
+++ b/templates/official-details.php
@@ -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 = '' . $team_name . '';
$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 = '' . $team_name . '';
$teams[] = $team_name;
endforeach;
diff --git a/templates/player-details.php b/templates/player-details.php
index b1254956..249c1949 100644
--- a/templates/player-details.php
+++ b/templates/player-details.php
@@ -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 = '' . $team_name . '';
$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 = '' . $team_name . '';
$teams[] = $team_name;
endforeach;
diff --git a/templates/player-list.php b/templates/player-list.php
index a9162cb6..dadd2fa1 100644
--- a/templates/player-list.php
+++ b/templates/player-list.php
@@ -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 = '' . $team_name . '';
endif;
diff --git a/templates/staff-details.php b/templates/staff-details.php
index 982a800a..6e400e54 100644
--- a/templates/staff-details.php
+++ b/templates/staff-details.php
@@ -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 = '' . $team_name . '';
$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 = '' . $team_name . '';
$teams[] = $team_name;
endforeach;