Add ability to choose multiple nationalities for players and staff
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
*
|
||||
* @author ThemeBoy
|
||||
* @package SportsPress/Templates
|
||||
* @version 1.8
|
||||
* @version 1.8.9
|
||||
*/
|
||||
|
||||
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
|
||||
@@ -28,7 +28,7 @@ $countries = SP()->countries->countries;
|
||||
|
||||
$player = new SP_Player( $id );
|
||||
|
||||
$nationality = $player->nationality;
|
||||
$nationalities = $player->nationalities();
|
||||
$positions = $player->positions();
|
||||
$current_teams = $player->current_teams();
|
||||
$past_teams = $player->past_teams();
|
||||
@@ -36,14 +36,18 @@ $metrics_before = $player->metrics( true );
|
||||
$metrics_after = $player->metrics( false );
|
||||
|
||||
$common = array();
|
||||
if ( $show_nationality && $nationality ):
|
||||
if ( 2 == strlen( $nationality ) ):
|
||||
$legacy = SP()->countries->legacy;
|
||||
$nationality = strtolower( $nationality );
|
||||
$nationality = sp_array_value( $legacy, $nationality, null );
|
||||
endif;
|
||||
$country_name = sp_array_value( $countries, $nationality, null );
|
||||
$common[ __( '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 : '—';
|
||||
if ( $show_nationality && $nationalities && is_array( $nationalities ) ):
|
||||
$values = array();
|
||||
foreach ( $nationalities as $nationality ):
|
||||
if ( 2 == strlen( $nationality ) ):
|
||||
$legacy = SP()->countries->legacy;
|
||||
$nationality = strtolower( $nationality );
|
||||
$nationality = sp_array_value( $legacy, $nationality, null );
|
||||
endif;
|
||||
$country_name = sp_array_value( $countries, $nationality, null );
|
||||
$values[] = $country_name ? ( $show_nationality_flags ? '<img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"> ' : '' ) . $country_name : '—';
|
||||
endforeach;
|
||||
$common[ __( 'Nationality', 'sportspress' ) ] = implode( '<br>', $values );
|
||||
endif;
|
||||
|
||||
if ( $show_positions && $positions ):
|
||||
|
||||
Reference in New Issue
Block a user