Add national flag option to player list
This commit is contained in:
@@ -43,11 +43,6 @@ $common = array();
|
||||
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;
|
||||
|
||||
@@ -20,7 +20,8 @@ $defaults = array(
|
||||
'order' => 'ASC',
|
||||
'show_all_players_link' => false,
|
||||
'show_title' => get_option( 'sportspress_list_show_title', 'yes' ) == 'yes' ? true : false,
|
||||
'show_player_photo' => get_option( 'sportspress_list_show_photos', 'yes' ) == 'yes' ? true : false,
|
||||
'show_player_photo' => get_option( 'sportspress_list_show_photos', 'no' ) == 'yes' ? true : false,
|
||||
'show_player_flag' => get_option( 'sportspress_list_show_flags', 'no' ) == 'yes' ? true : false,
|
||||
'link_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == 'yes' ? true : false,
|
||||
'sortable' => get_option( 'sportspress_enable_sortable_tables', 'yes' ) == 'yes' ? true : false,
|
||||
@@ -144,6 +145,17 @@ foreach ( $groups as $group ):
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $show_player_flag ):
|
||||
$player = new SP_Player( $player_id );
|
||||
$nationalities = $player->nationalities();
|
||||
if ( ! empty( $nationalities ) ):
|
||||
foreach ( $nationalities as $nationality ):
|
||||
$name = '<span class="player-flag"><img src="' . plugin_dir_url( SP_PLUGIN_FILE ) . 'assets/images/flags/' . strtolower( $nationality ) . '.png" alt="' . $nationality . '"></span>' . $name;
|
||||
endforeach;
|
||||
$name_class .= ' has-photo';
|
||||
endif;
|
||||
endif;
|
||||
|
||||
if ( $link_posts ):
|
||||
$permalink = get_post_permalink( $player_id );
|
||||
$name = '<a href="' . $permalink . '">' . $name . '</a>';
|
||||
|
||||
Reference in New Issue
Block a user