For specific categories remove featured image from product page gallery
-
Hi,
I am hoping to show the set featured image on the catalogue page and when a person clicks that image and goes to the single product page that featured image is not in the photo gallery and the first image from the photo gallery is displayed.
I have used this code and found it works;
add_filter('woocommerce_single_product_image_thumbnail_html', 'remove_featured_image', 10, 2); function remove_featured_image($html, $attachment_id ) { global $post, $product; $featured_image = get_post_thumbnail_id( $post->ID ); if ( $attachment_id == $featured_image ) $html = ''; return $html; }
Not all categories have a gallery, please can I have some advice as to how I can adapt the above code so that it only applies to certain product categories?
Thanks in advance,
- The topic ‘For specific categories remove featured image from product page gallery’ is closed to new replies.