diff --git a/assets/css/admin.css b/assets/css/admin.css index 171807c5..93e410c9 100644 --- a/assets/css/admin.css +++ b/assets/css/admin.css @@ -31,6 +31,21 @@ margin-bottom: 1px !important; } +.sp-link:before { + font: normal 20px/1 'dashicons'; + speak: none; + display: inline-block; + padding: 0 2px 0 0; + top: 0; + left: -1px; + position: relative; + vertical-align: top; + -webkit-font-smoothing: antialiased; + -moz-osx-font-smoothing: grayscale; + text-decoration: none !important; + content: "\f504"; +} + .fixed .column-sp_team .result, .sp-calendar-table .result { background: #888; 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 286e3710..67eb3d39 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-event.php +++ b/includes/admin/post-types/class-sp-admin-cpt-event.php @@ -120,7 +120,7 @@ class SP_Admin_CPT_Event extends SP_Admin_CPT { break; case 'sp_team': $teams = (array)get_post_meta( $post_id, 'sp_team', false ); - $teams = array_filter( $teams ); + $teams = array_unique( array_filter( $teams ) ); if ( empty( $teams ) ): echo '—'; else: 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 521087e0..1ce1ab30 100644 --- a/includes/admin/post-types/class-sp-admin-cpt-team.php +++ b/includes/admin/post-types/class-sp-admin-cpt-team.php @@ -61,6 +61,7 @@ class SP_Admin_CPT_Team extends SP_Admin_CPT { 'cb' => '', 'sp_icon' => '', 'title' => __( 'Team', 'sportspress' ), + 'sp_url' => __( 'URL', 'sportspress' ), 'sp_abbreviation' => __( 'Abbreviation', 'sportspress' ), 'sp_league' => __( 'Leagues', 'sportspress' ), 'sp_season' => __( 'Seasons', 'sportspress' ), @@ -77,6 +78,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 sp_get_url( $post_id ); + break; case 'sp_abbreviation': $abbreviation = get_post_meta ( $post_id, 'sp_abbreviation', true ); echo $abbreviation ? $abbreviation : '—'; diff --git a/includes/admin/post-types/meta-boxes/class-sp-meta-box-team-details.php b/includes/admin/post-types/meta-boxes/class-sp-meta-box-team-details.php index 1bdb86ae..b651395f 100644 --- a/includes/admin/post-types/meta-boxes/class-sp-meta-box-team-details.php +++ b/includes/admin/post-types/meta-boxes/class-sp-meta-box-team-details.php @@ -20,7 +20,14 @@ class SP_Meta_Box_Team_Details { */ public static function output( $post ) { $abbreviation = get_post_meta( $post->ID, 'sp_abbreviation', true ); + $url = get_post_meta( $post->ID, 'sp_url', true ); ?> +

+

+ +

+ +

@@ -31,6 +38,7 @@ class SP_Meta_Box_Team_Details { * Save meta box data */ public static function save( $post_id, $post ) { + update_post_meta( $post_id, 'sp_url', sp_array_value( $_POST, 'sp_url', '' ) ); update_post_meta( $post_id, 'sp_abbreviation', sp_array_value( $_POST, 'sp_abbreviation', '' ) ); } } \ No newline at end of file diff --git a/includes/sp-core-functions.php b/includes/sp-core-functions.php index 40cb806b..13ef9ff6 100644 --- a/includes/sp-core-functions.php +++ b/includes/sp-core-functions.php @@ -285,6 +285,14 @@ if ( !function_exists( 'sp_get_the_term_id' ) ) { } } +if ( !function_exists( 'sp_get_url' ) ) { + function sp_get_url( $post_id ) { + $url = get_post_meta( $post_id, 'sp_url', true ); + if ( ! $url ) return; + return ' ' . $url . ''; + } +} + if ( !function_exists( 'sp_get_post_precision' ) ) { function sp_get_post_precision( $post_id ) { $precision = get_post_meta ( $post_id, 'sp_precision', true );