Abbreviate team names independently
This commit is contained in:
@@ -35,6 +35,7 @@ class SP_League_Table extends SP_Custom_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;
|
||||
|
||||
// Get labels from result variables
|
||||
$result_labels = (array)sp_get_var_labels( 'sp_result' );
|
||||
@@ -537,7 +538,7 @@ class SP_League_Table extends SP_Custom_Post{
|
||||
// Add team name to row
|
||||
$merged[ $team_id ] = array();
|
||||
|
||||
$team_data['name'] = get_the_title( $team_id );
|
||||
$team_data['name'] = sp_get_team_name( $team_id, $abbreviate_teams );
|
||||
|
||||
foreach ( $team_data as $key => $value ):
|
||||
|
||||
|
||||
@@ -115,6 +115,7 @@ 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;
|
||||
|
||||
$args = array(
|
||||
'post_type' => array( 'sp_performance', 'sp_statistic' ),
|
||||
@@ -498,7 +499,7 @@ class SP_Player extends SP_Custom_Post {
|
||||
$season_name = sp_array_value( $season_names, $season_id, ' ' );
|
||||
|
||||
if ( $team_id ):
|
||||
$team_name = get_the_title( $team_id );
|
||||
$team_name = sp_get_team_name( $team_id, $abbreviate_teams );
|
||||
|
||||
if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false ):
|
||||
$team_permalink = get_permalink( $team_id );
|
||||
|
||||
@@ -231,7 +231,7 @@ function sp_get_logo_url( $post = 0, $size = 'icon' ) {
|
||||
}
|
||||
|
||||
function sp_get_abbreviation( $post = 0 ) {
|
||||
return get_post_meta ( $post, 'sp_abbreviation', true );
|
||||
return get_post_meta( $post, 'sp_abbreviation', true );
|
||||
}
|
||||
|
||||
function sp_get_venues( $post = 0, $ids = true ) {
|
||||
@@ -286,6 +286,14 @@ function sp_short_name( $post = 0 ) {
|
||||
echo sp_get_short_name( $post );
|
||||
}
|
||||
|
||||
function sp_get_team_name( $post = 0, $short = true ) {
|
||||
if ( $short ) {
|
||||
return sp_get_short_name( $post );
|
||||
} else {
|
||||
return get_the_title( $post );
|
||||
}
|
||||
}
|
||||
|
||||
function sp_team_details( $post = 0 ) {
|
||||
sp_get_template( 'team-details.php', array( 'id' => $post ) );
|
||||
}
|
||||
|
||||
@@ -268,18 +268,6 @@ function sportspress_team_permalink( $permalink, $post ) {
|
||||
}
|
||||
add_filter( 'post_type_link', 'sportspress_team_permalink', 10, 2 );
|
||||
|
||||
function sportspress_abbreviate_team( $title, $id = null ) {
|
||||
if ( ! is_admin() && 'sp_team' == get_post_type( $id ) && get_option( 'sportspress_abbreviate_teams', 'yes' ) == 'yes' ):
|
||||
if ( in_the_loop() && get_the_ID() == $id ) return $title;
|
||||
$abbreviation = get_post_meta( $id, 'sp_abbreviation', true );
|
||||
if ( ! empty( $abbreviation ) ):
|
||||
return $abbreviation;
|
||||
endif;
|
||||
endif;
|
||||
return $title;
|
||||
}
|
||||
add_filter( 'the_title', 'sportspress_abbreviate_team', 10, 2 );
|
||||
|
||||
function sportspress_no_terms_links( $term_list, $taxonomy ) {
|
||||
|
||||
if ( in_array( $taxonomy, array( 'sp_league', 'sp_season', 'sp_position', 'sp_role' ) ) )
|
||||
|
||||
@@ -24,6 +24,7 @@ $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,
|
||||
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_event_list_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
@@ -166,7 +167,7 @@ endif;
|
||||
|
||||
if ( $teams ):
|
||||
foreach ( $teams as $team ):
|
||||
$name = get_the_title( $team );
|
||||
$name = sp_get_team_name( $team, $abbreviate_teams );
|
||||
if ( $name ):
|
||||
|
||||
if ( $show_team_logo ):
|
||||
|
||||
@@ -13,6 +13,7 @@ if ( get_option( 'sportspress_event_show_logos', 'yes' ) === 'no' ) return;
|
||||
$show_team_names = get_option( 'sportspress_event_logos_show_team_names', 'no' ) === '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;
|
||||
|
||||
if ( ! isset( $id ) )
|
||||
$id = get_the_ID();
|
||||
@@ -43,9 +44,9 @@ if ( $teams ):
|
||||
// Add team name
|
||||
if ( $show_team_names ) {
|
||||
if ( $alt ) {
|
||||
$logo .= ' <strong class="sp-team-name">' . get_the_title( $team ) . '</strong>';
|
||||
$logo .= ' <strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong>';
|
||||
} else {
|
||||
$logo = '<strong class="sp-team-name">' . get_the_title( $team ) . '</strong> ' . $logo;
|
||||
$logo = '<strong class="sp-team-name">' . sp_get_team_name( $team, $abbreviate_teams ) . '</strong> ' . $logo;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ $show_staff = get_option( 'sportspress_event_show_staff', 'yes' ) === 'yes' ? tr
|
||||
$show_total = get_option( 'sportspress_event_show_total', 'yes' ) === 'yes' ? true : false;
|
||||
$show_numbers = get_option( 'sportspress_event_show_player_numbers', 'yes' ) === '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_performance_reverse_teams', 'no' ) === 'yes' ? true : false;
|
||||
$primary = sp_get_main_performance_option();
|
||||
$total = get_option( 'sportspress_event_total_performance', 'all');
|
||||
@@ -212,7 +213,7 @@ if ( is_array( $teams ) ):
|
||||
'show_players' => $show_team_players,
|
||||
'show_numbers' => $show_numbers,
|
||||
'show_total' => $show_total,
|
||||
'caption' => 0 == $s && $team_id ? get_the_title( $team_id ) : null,
|
||||
'caption' => 0 == $s && $team_id ? sp_get_team_name( $team_id, $abbreviate_teams ) : null,
|
||||
'labels' => $labels[ $section_id ],
|
||||
'formats' => $formats,
|
||||
'mode' => $mode,
|
||||
@@ -247,7 +248,7 @@ if ( is_array( $teams ) ):
|
||||
'show_players' => $show_team_players,
|
||||
'show_numbers' => $show_numbers,
|
||||
'show_total' => $show_total,
|
||||
'caption' => $team_id ? get_the_title( $team_id ) : null,
|
||||
'caption' => $team_id ? sp_get_team_name( $team_id, $abbreviate_teams ) : null,
|
||||
'labels' => $labels,
|
||||
'formats' => $formats,
|
||||
'mode' => $mode,
|
||||
|
||||
@@ -36,6 +36,7 @@ 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
|
||||
@@ -63,7 +64,7 @@ foreach( $data as $team_id => $result ):
|
||||
|
||||
$table_rows .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
||||
|
||||
$team_name = get_the_title( $team_id );
|
||||
$team_name = sp_get_team_name( $team_id, $abbreviate_teams );
|
||||
|
||||
if ( $link_teams ):
|
||||
$team_name = '<a href="' . get_post_permalink( $team_id ) . '">' . $team_name . '</a>';
|
||||
|
||||
@@ -21,6 +21,7 @@ $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,
|
||||
);
|
||||
|
||||
@@ -62,7 +63,7 @@ $data = array_merge( $metrics_before, $common, $metrics_after );
|
||||
if ( $show_current_teams && $current_teams ):
|
||||
$teams = array();
|
||||
foreach ( $current_teams as $team ):
|
||||
$team_name = get_the_title( $team );
|
||||
$team_name = sp_get_team_name( $team, $abbreviate_teams );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
@@ -72,7 +73,7 @@ endif;
|
||||
if ( $show_past_teams && $past_teams ):
|
||||
$teams = array();
|
||||
foreach ( $past_teams as $team ):
|
||||
$team_name = get_the_title( $team );
|
||||
$team_name = sp_get_team_name( $team, $abbreviate_teams );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
|
||||
@@ -24,6 +24,7 @@ $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,
|
||||
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'scrollable' => get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
'paginated' => get_option( 'sportspress_list_paginated', 'yes' ) == 'yes' ? true : false,
|
||||
@@ -170,7 +171,7 @@ foreach ( $groups as $group ):
|
||||
|
||||
if ( array_key_exists( 'team', $labels ) ):
|
||||
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_team', true ) );
|
||||
$team_name = get_the_title( $team );
|
||||
$team_name = sp_get_team_name( $team, $abbreviate_teams );
|
||||
if ( $link_teams ):
|
||||
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
endif;
|
||||
|
||||
@@ -19,6 +19,7 @@ $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 );
|
||||
@@ -49,7 +50,7 @@ endif;
|
||||
if ( $show_current_teams && $current_teams ):
|
||||
$teams = array();
|
||||
foreach ( $current_teams as $team ):
|
||||
$team_name = get_the_title( $team );
|
||||
$team_name = sp_get_team_name( $team, $abbreviate_teams );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
@@ -59,7 +60,7 @@ endif;
|
||||
if ( $show_past_teams && $past_teams ):
|
||||
$teams = array();
|
||||
foreach ( $past_teams as $team ):
|
||||
$team_name = get_the_title( $team );
|
||||
$team_name = sp_get_team_name( $team, $abbreviate_teams );
|
||||
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||
$teams[] = $team_name;
|
||||
endforeach;
|
||||
|
||||
Reference in New Issue
Block a user