Added option to link staff members to profile page #166

This commit is contained in:
Paresh Radadiya
2018-01-14 20:40:29 +05:30
parent 6b25ccaca3
commit 4ebcaeff4e
2 changed files with 13 additions and 4 deletions

View File

@@ -51,13 +51,21 @@ class SP_Settings_Teams extends SP_Settings_Page {
array( 'type' => 'team_tabs' ),
array(
'title' => __( 'Link', 'sportspress' ),
'desc' => __( 'Link teams', 'sportspress' ),
'id' => 'sportspress_link_teams',
'title' => __( 'Staff', 'sportspress' ),
'desc' => __( 'Link staff', 'sportspress' ),
'id' => 'sportspress_team_link_staff',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Link', 'sportspress' ),
'desc' => __( 'Link teams', 'sportspress' ),
'id' => 'sportspress_link_teams',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Venue', 'sportspress' ),
'desc' => __( 'Link venues', 'sportspress' ),

View File

@@ -14,6 +14,7 @@ if ( ! isset( $id ) )
$team = new SP_Team( $id );
$members = $team->staff();
$link_staff = get_option( 'sportspress_team_link_staff', 'no' ) === 'yes' ? true : false;
foreach ( $members as $staff ):
$id = $staff->ID;
@@ -27,7 +28,7 @@ foreach ( $members as $staff ):
$name = '<span class="sp-staff-role">' . implode( '<span class="sp-staff-role-delimiter">/</span>', $roles ) . '</span> ' . $name;
endif;
?>
<h4 class="sp-staff-name"><?php echo $name; ?></h4>
<h4 class="sp-staff-name"><?php echo $link_staff ? '<a href="'. get_permalink( $id ) .'">'. $name .'</a>' : $name ?></h4>
<?php
sp_get_template( 'staff-photo.php', array( 'id' => $id ) );
sp_get_template( 'staff-details.php', array( 'id' => $id ) );