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

@@ -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 );

View File

@@ -62,7 +62,7 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT {
'cb' => '<input type="checkbox" />',
'sp_icon' => '<span class="dashicons sp-icon-shield sp-tip" title="' . __( 'Logo', 'sportspress' ) . '"></span>',
'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 ), '<a>' );
case 'sp_short_name':
$short_name = get_post_meta ( $post_id, 'sp_short_name', true );
echo $short_name ? esc_html( $short_name ) : '&mdash;';
break;
case 'sp_abbreviation':
$abbreviation = get_post_meta ( $post_id, 'sp_abbreviation', true );

View File

@@ -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' ),