From 518f235832dbfac7a19591ed90843d2829e7160a Mon Sep 17 00:00:00 2001 From: savvasha Date: Fri, 23 Aug 2019 19:32:57 +0300 Subject: [PATCH] FIX: "When an image is used for a statistic, the image is not displayed on player lists and players pages --- includes/class-sp-player.php | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/includes/class-sp-player.php b/includes/class-sp-player.php index ad297298..ab7f4833 100644 --- a/includes/class-sp-player.php +++ b/includes/class-sp-player.php @@ -589,7 +589,12 @@ class SP_Player extends SP_Custom_Post { if ( $icon != '' ) { $stats[ $post->post_name ] = $icon; }else{ - $stats[ $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 ) ) ); + $stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 ); + }else{ + $stats[ $post->post_name ] = $post->post_title; + } } }else{ $stats[ $post->post_name ] = $post->post_title; @@ -608,8 +613,13 @@ class SP_Player extends SP_Custom_Post { $icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 ); if ( $icon != '' ) { $stats[ $post->post_name ] = $icon; - } else { - $stats[ $post->post_name ] = $post->post_title; + }else{ + if ( has_post_thumbnail( $post ) ) { + $icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) ); + $stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 ); + }else{ + $stats[ $post->post_name ] = $post->post_title; + } } } else { $stats[ $post->post_name ] = $post->post_title; @@ -621,8 +631,13 @@ class SP_Player extends SP_Custom_Post { $icon = apply_filters( 'sportspress_event_performance_icons', '', $post->ID, 1 ); if ( $icon != '' ) { $stats[ $post->post_name ] = $icon; - } else { - $stats[ $post->post_name ] = $post->post_title; + }else{ + if ( has_post_thumbnail( $post ) ) { + $icon = get_the_post_thumbnail( $post, 'sportspress-fit-mini', array( 'title' => sp_get_singular_name( $post ) ) ); + $stats[ $post->post_name ] = apply_filters( 'sportspress_event_performance_icons', $icon, $post->ID, 1 ); + }else{ + $stats[ $post->post_name ] = $post->post_title; + } } } else { $stats[ $post->post_name ] = $post->post_title;