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 );
|
$usecolumns = get_post_meta( $this->ID, 'sp_columns', true );
|
||||||
$adjustments = get_post_meta( $this->ID, 'sp_adjustments', true );
|
$adjustments = get_post_meta( $this->ID, 'sp_adjustments', true );
|
||||||
$select = get_post_meta( $this->ID, 'sp_select', 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
|
// Get labels from result variables
|
||||||
$result_labels = (array)sp_get_var_labels( 'sp_result' );
|
$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
|
// Add team name to row
|
||||||
$merged[ $team_id ] = array();
|
$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 ):
|
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 );
|
$metrics = (array)get_post_meta( $this->ID, 'sp_metrics', true );
|
||||||
$stats = (array)get_post_meta( $this->ID, 'sp_statistics', 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() );
|
$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(
|
$args = array(
|
||||||
'post_type' => array( 'sp_performance', 'sp_statistic' ),
|
'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, ' ' );
|
$season_name = sp_array_value( $season_names, $season_id, ' ' );
|
||||||
|
|
||||||
if ( $team_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 ):
|
if ( get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false ):
|
||||||
$team_permalink = get_permalink( $team_id );
|
$team_permalink = get_permalink( $team_id );
|
||||||
|
|||||||
@@ -286,6 +286,14 @@ function sp_short_name( $post = 0 ) {
|
|||||||
echo sp_get_short_name( $post );
|
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 ) {
|
function sp_team_details( $post = 0 ) {
|
||||||
sp_get_template( 'team-details.php', array( 'id' => $post ) );
|
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 );
|
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 ) {
|
function sportspress_no_terms_links( $term_list, $taxonomy ) {
|
||||||
|
|
||||||
if ( in_array( $taxonomy, array( 'sp_league', 'sp_season', 'sp_position', 'sp_role' ) ) )
|
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_events' => get_option( 'sportspress_link_events', 'yes' ) == 'yes' ? true : false,
|
||||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == '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,
|
'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,
|
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||||
'scrollable' => get_option( 'sportspress_enable_scrollable_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,
|
'paginated' => get_option( 'sportspress_event_list_paginated', 'yes' ) == 'yes' ? true : false,
|
||||||
@@ -166,7 +167,7 @@ endif;
|
|||||||
|
|
||||||
if ( $teams ):
|
if ( $teams ):
|
||||||
foreach ( $teams as $team ):
|
foreach ( $teams as $team ):
|
||||||
$name = get_the_title( $team );
|
$name = sp_get_team_name( $team, $abbreviate_teams );
|
||||||
if ( $name ):
|
if ( $name ):
|
||||||
|
|
||||||
if ( $show_team_logo ):
|
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_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_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;
|
$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 ) )
|
if ( ! isset( $id ) )
|
||||||
$id = get_the_ID();
|
$id = get_the_ID();
|
||||||
@@ -43,9 +44,9 @@ if ( $teams ):
|
|||||||
// Add team name
|
// Add team name
|
||||||
if ( $show_team_names ) {
|
if ( $show_team_names ) {
|
||||||
if ( $alt ) {
|
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 {
|
} 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_total = get_option( 'sportspress_event_show_total', 'yes' ) === 'yes' ? true : false;
|
||||||
$show_numbers = get_option( 'sportspress_event_show_player_numbers', '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 );
|
$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;
|
$reverse_teams = get_option( 'sportspress_event_performance_reverse_teams', 'no' ) === 'yes' ? true : false;
|
||||||
$primary = sp_get_main_performance_option();
|
$primary = sp_get_main_performance_option();
|
||||||
$total = get_option( 'sportspress_event_total_performance', 'all');
|
$total = get_option( 'sportspress_event_total_performance', 'all');
|
||||||
@@ -212,7 +213,7 @@ if ( is_array( $teams ) ):
|
|||||||
'show_players' => $show_team_players,
|
'show_players' => $show_team_players,
|
||||||
'show_numbers' => $show_numbers,
|
'show_numbers' => $show_numbers,
|
||||||
'show_total' => $show_total,
|
'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 ],
|
'labels' => $labels[ $section_id ],
|
||||||
'formats' => $formats,
|
'formats' => $formats,
|
||||||
'mode' => $mode,
|
'mode' => $mode,
|
||||||
@@ -247,7 +248,7 @@ if ( is_array( $teams ) ):
|
|||||||
'show_players' => $show_team_players,
|
'show_players' => $show_team_players,
|
||||||
'show_numbers' => $show_numbers,
|
'show_numbers' => $show_numbers,
|
||||||
'show_total' => $show_total,
|
'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,
|
'labels' => $labels,
|
||||||
'formats' => $formats,
|
'formats' => $formats,
|
||||||
'mode' => $mode,
|
'mode' => $mode,
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ if ( empty( $data ) )
|
|||||||
|
|
||||||
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
$scrollable = get_option( 'sportspress_enable_scrollable_tables', 'yes' ) == 'yes' ? true : false;
|
||||||
$link_teams = get_option( 'sportspress_link_teams', 'no' ) == '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 );
|
$show_outcomes = array_key_exists( 'outcome', $labels );
|
||||||
|
|
||||||
// Initialize
|
// Initialize
|
||||||
@@ -63,7 +64,7 @@ foreach( $data as $team_id => $result ):
|
|||||||
|
|
||||||
$table_rows .= '<tr class="' . ( $i % 2 == 0 ? 'odd' : 'even' ) . '">';
|
$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 ):
|
if ( $link_teams ):
|
||||||
$team_name = '<a href="' . get_post_permalink( $team_id ) . '">' . $team_name . '</a>';
|
$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_leagues' => get_option( 'sportspress_player_show_leagues', 'no' ) == 'yes' ? true : false,
|
||||||
'show_seasons' => get_option( 'sportspress_player_show_seasons', '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,
|
'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,
|
'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 ):
|
if ( $show_current_teams && $current_teams ):
|
||||||
$teams = array();
|
$teams = array();
|
||||||
foreach ( $current_teams as $team ):
|
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>';
|
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||||
$teams[] = $team_name;
|
$teams[] = $team_name;
|
||||||
endforeach;
|
endforeach;
|
||||||
@@ -72,7 +73,7 @@ endif;
|
|||||||
if ( $show_past_teams && $past_teams ):
|
if ( $show_past_teams && $past_teams ):
|
||||||
$teams = array();
|
$teams = array();
|
||||||
foreach ( $past_teams as $team ):
|
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>';
|
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||||
$teams[] = $team_name;
|
$teams[] = $team_name;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ $defaults = array(
|
|||||||
'show_player_flag' => get_option( 'sportspress_list_show_flags', 'no' ) == 'yes' ? true : false,
|
'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_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
||||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == '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,
|
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||||
'scrollable' => get_option( 'sportspress_enable_scrollable_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,
|
'paginated' => get_option( 'sportspress_list_paginated', 'yes' ) == 'yes' ? true : false,
|
||||||
@@ -170,7 +171,7 @@ foreach ( $groups as $group ):
|
|||||||
|
|
||||||
if ( array_key_exists( 'team', $labels ) ):
|
if ( array_key_exists( 'team', $labels ) ):
|
||||||
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_team', true ) );
|
$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 ):
|
if ( $link_teams ):
|
||||||
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||||
endif;
|
endif;
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ $defaults = array(
|
|||||||
'show_past_teams' => get_option( 'sportspress_staff_show_past_teams', 'yes' ) == 'yes' ? true : false,
|
'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,
|
'show_nationality_flags' => get_option( 'sportspress_staff_show_flags', 'yes' ) == 'yes' ? true : false,
|
||||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == '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 );
|
extract( $defaults, EXTR_SKIP );
|
||||||
@@ -49,7 +50,7 @@ endif;
|
|||||||
if ( $show_current_teams && $current_teams ):
|
if ( $show_current_teams && $current_teams ):
|
||||||
$teams = array();
|
$teams = array();
|
||||||
foreach ( $current_teams as $team ):
|
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>';
|
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||||
$teams[] = $team_name;
|
$teams[] = $team_name;
|
||||||
endforeach;
|
endforeach;
|
||||||
@@ -59,7 +60,7 @@ endif;
|
|||||||
if ( $show_past_teams && $past_teams ):
|
if ( $show_past_teams && $past_teams ):
|
||||||
$teams = array();
|
$teams = array();
|
||||||
foreach ( $past_teams as $team ):
|
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>';
|
if ( $link_teams ) $team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||||
$teams[] = $team_name;
|
$teams[] = $team_name;
|
||||||
endforeach;
|
endforeach;
|
||||||
|
|||||||
Reference in New Issue
Block a user