Add option to hide player/staff details close #144
This commit is contained in:
@@ -14,6 +14,9 @@ if ( ! isset( $id ) )
|
||||
$id = get_the_ID();
|
||||
|
||||
$defaults = array(
|
||||
'show_nationality' => get_option( 'sportspress_staff_show_nationality', 'yes' ) == 'yes' ? true : false,
|
||||
'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,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
);
|
||||
@@ -29,7 +32,7 @@ $current_teams = $staff->current_teams();
|
||||
$past_teams = $staff->past_teams();
|
||||
|
||||
$data = array();
|
||||
if ( $nationality ):
|
||||
if ( $show_nationality && $nationality ):
|
||||
if ( 2 == strlen( $nationality ) ):
|
||||
$legacy = SP()->countries->legacy;
|
||||
$nationality = strtolower( $nationality );
|
||||
@@ -39,7 +42,7 @@ if ( $nationality ):
|
||||
$data[ __( 'Nationality', 'sportspress' ) ] = $country_name ? ( $show_nationality_flags ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '—';
|
||||
endif;
|
||||
|
||||
if ( $current_teams ):
|
||||
if ( $show_current_teams && $current_teams ):
|
||||
$teams = array();
|
||||
foreach ( $current_teams as $team ):
|
||||
$team_name = get_the_title( $team );
|
||||
@@ -49,7 +52,7 @@ if ( $current_teams ):
|
||||
$data[ __( 'Current Team', 'sportspress' ) ] = implode( ', ', $teams );
|
||||
endif;
|
||||
|
||||
if ( $past_teams ):
|
||||
if ( $show_past_teams && $past_teams ):
|
||||
$teams = array();
|
||||
foreach ( $past_teams as $team ):
|
||||
$team_name = get_the_title( $team );
|
||||
@@ -61,6 +64,9 @@ endif;
|
||||
|
||||
$data = apply_filters( 'sportspress_staff_details', $data, $id );
|
||||
|
||||
if ( empty( $data ) )
|
||||
return;
|
||||
|
||||
$output = '<div class="sp-list-wrapper">' .
|
||||
'<dl class="sp-staff-details">';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user