Allow multiple staff roles and display with delimiter

This commit is contained in:
Brian Miyaji
2017-11-14 22:34:43 +11:00
parent cf4dd17239
commit d5098b0ef7
6 changed files with 43 additions and 26 deletions

View File

@@ -44,9 +44,10 @@ function sportspress_the_title( $title, $id = null ) {
endif;
elseif ( is_singular( 'sp_staff' ) ):
$staff = new SP_Staff( $id );
$role = $staff->role();
if ( $role ):
$title = '<strong class="sp-staff-role">' . $role->name . '</strong> ' . $title;
$roles = $staff->roles();
if ( ! empty( $roles ) ):
$roles = wp_list_pluck( $roles, 'name' );
$title = '<strong class="sp-staff-role">' . implode( '<span class="sp-staff-role-delimiter">/</span>', $roles ) . '</strong> ' . $title;
endif;
endif;
endif;