diff --git a/includes/class-sp-staff.php b/includes/class-sp-staff.php
index 6802486d..46894189 100644
--- a/includes/class-sp-staff.php
+++ b/includes/class-sp-staff.php
@@ -12,6 +12,16 @@
*/
class SP_Staff extends SP_Custom_Post {
+ /**
+ * Returns current teams
+ *
+ * @access public
+ * @return array
+ */
+ public function current_teams() {
+ return get_post_meta( $this->ID, 'sp_current_team', false );
+ }
+
/**
* Returns past teams
*
diff --git a/templates/staff-details.php b/templates/staff-details.php
index eb6f2100..315244be 100644
--- a/templates/staff-details.php
+++ b/templates/staff-details.php
@@ -15,6 +15,7 @@ if ( ! isset( $id ) )
$defaults = array(
'show_nationality_flags' => get_option( 'sportspress_staff_show_flags', 'yes' ) == 'yes' ? true : false,
+ 'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
);
extract( $defaults, EXTR_SKIP );
@@ -24,7 +25,7 @@ $countries = SP()->countries->countries;
$staff = new SP_Staff( $id );
$nationality = $staff->nationality;
-$current_team = $staff->current_team;
+$current_teams = $staff->current_teams();
$past_teams = $staff->past_teams();
$data = array();
@@ -38,13 +39,22 @@ if ( $nationality ):
$data[ __( 'Nationality', 'sportspress' ) ] = $country_name ? ( $show_nationality_flags ? '
' : '' ) . $country_name : '—';
endif;
-if ( $current_team )
- $data[ __( 'Current Team', 'sportspress' ) ] = '' . get_the_title( $current_team ) . '';
+if ( $current_teams ):
+ $teams = array();
+ foreach ( $current_teams as $team ):
+ $team_name = get_the_title( $team );
+ if ( $link_teams ) $team_name = '' . $team_name . '';
+ $teams[] = $team_name;
+ endforeach;
+ $data[ __( 'Current Team', 'sportspress' ) ] = implode( ', ', $teams );
+endif;
if ( $past_teams ):
$teams = array();
foreach ( $past_teams as $team ):
- $teams[] = '' . get_the_title( $team ) . '';
+ $team_name = get_the_title( $team );
+ if ( $link_teams ) $team_name = '' . $team_name . '';
+ $teams[] = $team_name;
endforeach;
$data[ __( 'Past Teams', 'sportspress' ) ] = implode( ', ', $teams );
endif;