From 12ba104f194b912c5548839bb9cdfc51a10331a0 Mon Sep 17 00:00:00 2001
From: Sebastian Gurlt
+ + +
+ 'yes', 'type' => 'checkbox', ), + + array( + 'title' => esc_attr__( 'Contact', 'sportspress' ), + 'desc' => esc_attr__( 'Display phone number', 'sportspress' ), + 'id' => 'sportspress_staff_show_phone_number', + 'default' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => 'start', + ), + + array( + 'desc' => esc_attr__( 'Display mail address', 'sportspress' ), + 'id' => 'sportspress_staff_show_mail_address', + 'default' => 'yes', + 'type' => 'checkbox', + 'checkboxgroup' => 'end', + ), ) ), array( diff --git a/includes/class-sp-staff.php b/includes/class-sp-staff.php index 6187d3d6..50fe884f 100644 --- a/includes/class-sp-staff.php +++ b/includes/class-sp-staff.php @@ -42,6 +42,26 @@ public function nationalities() { return get_post_meta( $this->ID, 'sp_nationality', false ); } + /** + * Returns phone number + * + * @access public + * @return string + */ + public function phone_number() { + return get_post_meta( $this->ID, 'sp_phone_number', true ); + } + + /** + * Returns mail address + * + * @access public + * @return string + */ + public function mail_address() { + return get_post_meta( $this->ID, 'sp_mail_address', true ); + } + /** * Returns role * diff --git a/templates/staff-details.php b/templates/staff-details.php index 4183f460..43263721 100644 --- a/templates/staff-details.php +++ b/templates/staff-details.php @@ -23,6 +23,8 @@ 'show_current_teams' => get_option( 'sportspress_staff_show_current_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_phone_number' => get_option( 'sportspress_staff_show_phone_number', 'yes' ) == 'yes' ? true : false, + 'show_mail_address' => get_option( 'sportspress_staff_show_mail_address', 'yes' ) == 'yes' ? true : false, 'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false, ); @@ -35,6 +37,8 @@ $nationalities = $staff->nationalities(); $current_teams = $staff->current_teams(); $past_teams = $staff->past_teams(); +$phone_number = $staff->phone_number(); +$mail_address = $staff->mail_address(); $data = array(); if ( $show_nationality && $nationalities && is_array( $nationalities ) ) : @@ -75,6 +79,14 @@ $data[ esc_attr__( 'Past Teams', 'sportspress' ) ] = implode( ', ', $teams ); endif; +if ( $show_phone_number && $phone_number ) : + $data[ esc_attr__( 'Phone number', 'sportspress' ) ] = ''.$phone_number.''; +endif; + +if ( $show_mail_address && $mail_address ) : + $data[ esc_attr__( 'Mail address', 'sportspress' ) ] = ''.$mail_address.'';; +endif; + $data = apply_filters( 'sportspress_staff_details', $data, $id ); if ( empty( $data ) ) {