From 78fcc42b356a126a9fee87df9e941b0be25268d2 Mon Sep 17 00:00:00 2001 From: Nathan Schmidt <91974372+nathan-schmidt-viget@users.noreply.github.com> Date: Mon, 18 Dec 2023 13:59:36 -0700 Subject: [PATCH] [#39] Setting default image for Auction index --- .../goodbids/src/classes/Auctions/Auctions.php | 14 +++++++++----- .../patterns/template-archive-auction.php | 10 ++++++++-- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php b/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php index 03663abe4..c642ae2a7 100644 --- a/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php +++ b/client-mu-plugins/goodbids/src/classes/Auctions/Auctions.php @@ -468,15 +468,19 @@ function ( int $post_id ) { private function set_default_feature_image(): void { add_filter( 'post_thumbnail_html', - function ( string $html, int $blog_id ) { + function ( string $html, int $auction_id ) { if ( $html ) { return $html; } - return sprintf( - '', - esc_attr( GOODBIDS_PLUGIN_URL . 'assets/images/goodbids-logo.png' ), - ); + if ( is_post_type_archive( 'gb-auction' ) ) { + $reward_id = goodbids()->auctions->get_reward_product_id( $auction_id ); + $product = wc_get_product( $reward_id ); + $product_html = $product->get_image(); + return sprintf( + $product_html, + ); + } }, 10, 2 diff --git a/themes/goodbids-nonprofit/patterns/template-archive-auction.php b/themes/goodbids-nonprofit/patterns/template-archive-auction.php index 7cae5fcfb..2dc5e583c 100644 --- a/themes/goodbids-nonprofit/patterns/template-archive-auction.php +++ b/themes/goodbids-nonprofit/patterns/template-archive-auction.php @@ -1,7 +1,13 @@
- -

+ + + + + +

+ +