Add an extra option to show Team Logos instead of Team Names at Player Lists
This commit is contained in:
@@ -203,7 +203,8 @@
|
|||||||
line-height: 2em;
|
line-height: 2em;
|
||||||
}
|
}
|
||||||
.sp-player-list .data-name .player-photo,
|
.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;
|
width: 2em;
|
||||||
height: 2em;
|
height: 2em;
|
||||||
margin-right: 0.5em;
|
margin-right: 0.5em;
|
||||||
@@ -212,7 +213,8 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
.sp-player-list .data-name .player-photo img,
|
.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;
|
width: auto;
|
||||||
height: auto;
|
height: auto;
|
||||||
max-width: 2em;
|
max-width: 2em;
|
||||||
|
|||||||
@@ -266,6 +266,14 @@ class SportsPress_Player_Lists {
|
|||||||
'type' => 'checkbox',
|
'type' => 'checkbox',
|
||||||
'checkboxgroup' => 'end',
|
'checkboxgroup' => 'end',
|
||||||
),
|
),
|
||||||
|
|
||||||
|
array(
|
||||||
|
'title' => __( 'Teeams', 'sportspress' ),
|
||||||
|
'desc' => __( 'Display Teams Logos', 'sportspress' ),
|
||||||
|
'id' => 'sportspress_list_show_logos',
|
||||||
|
'default' => 'no',
|
||||||
|
'type' => 'checkbox',
|
||||||
|
),
|
||||||
|
|
||||||
array(
|
array(
|
||||||
'title' => __( 'Pagination', 'sportspress' ),
|
'title' => __( 'Pagination', 'sportspress' ),
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ $defaults = array(
|
|||||||
'show_title' => get_option( 'sportspress_list_show_title', 'yes' ) == 'yes' ? true : false,
|
'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_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_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_posts' => get_option( 'sportspress_link_players', 'yes' ) == 'yes' ? true : false,
|
||||||
'link_teams' => get_option( 'sportspress_link_teams', 'no' ) == '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,
|
'responsive' => get_option( 'sportspress_enable_responsive_tables', 'no' ) == 'yes' ? true : false,
|
||||||
@@ -193,8 +194,12 @@ foreach ( $groups as $group ):
|
|||||||
$tbody .= '<td class="data-name' . $name_class . '" data-label="'.$labels['name'].'">' . $name . '</td>';
|
$tbody .= '<td class="data-name' . $name_class . '" data-label="'.$labels['name'].'">' . $name . '</td>';
|
||||||
|
|
||||||
if ( array_key_exists( 'team', $labels ) ):
|
if ( array_key_exists( 'team', $labels ) ):
|
||||||
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_current_team', true ) );
|
$team = sp_array_value( $row, 'team', get_post_meta( $id, 'sp_current_team', true ) );
|
||||||
$team_name = $team ? sp_team_short_name( $team ) : '-';
|
$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 ) ):
|
if ( $link_teams && false !== get_post_status( $team ) ):
|
||||||
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
$team_name = '<a href="' . get_post_permalink( $team ) . '">' . $team_name . '</a>';
|
||||||
endif;
|
endif;
|
||||||
|
|||||||
Reference in New Issue
Block a user