From 52f96851b143b141ef905066cb1566b599af922b Mon Sep 17 00:00:00 2001 From: Brian Miyaji Date: Wed, 2 May 2018 12:56:29 +1000 Subject: [PATCH] Add forced setting to abbreviations --- includes/sp-api-functions.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/includes/sp-api-functions.php b/includes/sp-api-functions.php index bec09a42..5b8283c5 100644 --- a/includes/sp-api-functions.php +++ b/includes/sp-api-functions.php @@ -291,17 +291,17 @@ function sp_team_logo( $post = 0 ) { sp_get_template( 'team-logo.php', array( 'id' => $post ) ); } -function sp_team_abbreviation( $post = 0 ) { +function sp_team_abbreviation( $post = 0, $forced = false ) { $abbreviation = get_post_meta( $post, 'sp_abbreviation', true ); if ( $abbreviation ) { return $abbreviation; } else { - return sp_team_short_name( $post ); + return $forced ? substr( strtoupper( sp_team_short_name( $post ) ), 0, 3 ) : sp_team_short_name( $post ); } } -function sp_the_abbreviation( $post = 0 ) { - echo sp_team_abbreviation( $post ); +function sp_the_abbreviation( $post = 0, $forced = false ) { + echo sp_team_abbreviation( $post, $forced ); } function sp_team_short_name( $post = 0 ) {