Add an extra option to show Team Logos instead of Team Names at Player Lists

This commit is contained in:
savvasha
2019-02-14 17:13:08 +02:00
parent 5020512242
commit e3ec12e03c
3 changed files with 18 additions and 3 deletions

View File

@@ -203,7 +203,8 @@
line-height: 2em;
}
.sp-player-list .data-name .player-photo,
.sp-player-list .data-name .player-flag {
.sp-player-list .data-name .player-flag,
.sp-player-list .data-team .team-logo {
width: 2em;
height: 2em;
margin-right: 0.5em;
@@ -212,7 +213,8 @@
text-align: center;
}
.sp-player-list .data-name .player-photo img,
.sp-player-list .data-name .player-flag img {
.sp-player-list .data-name .player-flag img,
.sp-player-list .data-team .team-logo img {
width: auto;
height: auto;
max-width: 2em;

View File

@@ -267,6 +267,14 @@ class SportsPress_Player_Lists {
'checkboxgroup' => 'end',
),
array(
'title' => __( 'Teeams', 'sportspress' ),
'desc' => __( 'Display Teams Logos', 'sportspress' ),
'id' => 'sportspress_list_show_logos',
'default' => 'no',
'type' => 'checkbox',
),
array(
'title' => __( 'Pagination', 'sportspress' ),
'desc' => __( 'Paginate', 'sportspress' ),

View File

@@ -22,6 +22,7 @@ $defaults = array(
'show_title' => get_option( 'sportspress_list_show_title', '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,
'show_teams_logo' => get_option( 'sportspress_list_show_logos', '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,
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
@@ -195,6 +196,10 @@ foreach ( $groups as $group ):
if ( array_key_exists( 'team', $labels ) ):
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_current_team', true ) );
$team_name = $team ? sp_team_short_name( $team ) : '-';
if ( $show_teams_logo && has_post_thumbnail( $team ) ){
$logo = get_the_post_thumbnail( $team, 'sportspress-fit-icon', array( 'title' => ''.$team_name.'' ) );
$team_name = '<span class="team-logo">' . $logo . '</span>';
}
if ( $link_teams && false !== get_post_status( $team ) ):
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
endif;