From 856fbf8a34c341045985116d2268c74e264474f4 Mon Sep 17 00:00:00 2001 From: savvasha Date: Fri, 26 Jul 2019 12:18:52 +0300 Subject: [PATCH] FIX: "When an image is used for a performance, the image is not displayed on player lists and players page" --- includes/class-sp-player-list.php | 9 +++++++-- includes/class-sp-player.php | 18 ++++++++++++++---- 2 files changed, 21 insertions(+), 6 deletions(-) diff --git a/includes/class-sp-player-list.php b/includes/class-sp-player-list.php index 3150cdb5..db55a0e4 100644 --- a/includes/class-sp-player-list.php +++ b/includes/class-sp-player-list.php @@ -229,9 +229,14 @@ class SP_Player_List extends SP_Secondary_Post { if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' && ( $stat->post_type == 'sp_performance' || $stat->post_type == 'sp_statistic' ) ) { $icon = apply_filters( 'sportspress_event_performance_icons', '', $stat->ID, 1 ); if ( $icon != '' ) { - $columns[ $stat->post_name ] = apply_filters( 'sportspress_event_performance_icons', '', $stat->ID, 1 ); + $columns[ $stat->post_name ] = $icon; }else{ - $columns[ $stat->post_name ] = $stat->post_title; + if ( has_post_thumbnail( $stat ) ) { + $icon = get_the_post_thumbnail( $stat, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $stat ) ) ); + $columns[ $stat->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $stat->ID, 1 ); + }else{ + $columns[ $stat->post_name ] = $stat->post_title; + } } }else{ $columns[ $stat->post_name ] = $stat->post_title; diff --git a/includes/class-sp-player.php b/includes/class-sp-player.php index 39b4969e..60042072 100644 --- a/includes/class-sp-player.php +++ b/includes/class-sp-player.php @@ -175,9 +175,14 @@ class SP_Player extends SP_Custom_Post { if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) { $icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 ); if ( $icon != '' ) { - $performance_labels[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 ); + $performance_labels[ $post->post_name ] = $icon; }else{ - $performance_labels[ $post->post_name ] = $post->post_title; + if ( has_post_thumbnail( $post ) ) { + $icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) ); + $performance_labels[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 ); + }else{ + $performance_labels[ $post->post_name ] = $post->post_title; + } } }else{ $performance_labels[ $post->post_name ] = $post->post_title; @@ -193,9 +198,14 @@ class SP_Player extends SP_Custom_Post { if ( get_option( 'sportspress_player_statistics_mode', 'values' ) == 'icons' ) { $icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 ); if ( $icon != '' ) { - $performance_labels[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 ); + $performance_labels[ $post->post_name ] = $icon; }else{ - $performance_labels[ $post->post_name ] = $post->post_title; + if ( has_post_thumbnail( $post ) ) { + $icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) ); + $performance_labels[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 ); + }else{ + $performance_labels[ $post->post_name ] = $post->post_title; + } } }else{ $performance_labels[ $post->post_name ] = $post->post_title;