Home / Forums / WoodMart support forum / Featured image different than product image
Home › Forums › WoodMart support forum › Featured image different than product image
Featured image different than product image
- This topic has 5 replies, 2 voices, and was last updated 6 years, 3 months ago by
John.
-
AuthorPosts
-
March 15, 2020 at 5:51 pm #180094
JohnParticipantHello there, I would like to set different images for shop page and product page so I found the code below.
Is there any chance to implement this code in your theme ? Thanks in advance.<?php $attachment_ids = $product->get_gallery_attachment_ids(); isset ($placeholder_width)? : $placeholder_width=0; isset ($placeholder_height)? : $placeholder_height=0; if ( $attachment_ids ) { $attachment_id = $attachment_ids[0]; if ( ! $placeholder_width ) $placeholder_width = $woocommerce->get_image_size( 'shop_catalog_image_width' ); if ( ! $placeholder_height ) $placeholder_height = $woocommerce->get_image_size( 'shop_catalog_image_height' ); $output = '<div class="imagewrapper">'; //$classes = array( 'imagewrapper' ); $classes = array(); $image_link = wp_get_attachment_url( $attachment_id ); if ( $image_link ) { $image = wp_get_attachment_image( $attachment_id, apply_filters( 'single_product_thumbnail_size', 'shop_thumbnail' ) ); $image_class = esc_attr( implode( ' ', $classes ) ); $image_title = esc_attr( get_the_title( $attachment_id ) ); echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<a href="%s" itemprop="image" class="woocommerce-main-image zoom" title="%s" rel="prettyPhoto[product-gallery]">%s</a>', $image_link, $image_title, $image ), $post->ID ); } else { echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '<img src="%s" alt="Placeholder" />', woocommerce_placeholder_img_src() ), $post->ID ); } } ?> <?php do_action( 'woocommerce_product_thumbnails' ); ?>In theme/woocommerce/single-product/product-image.php
Here is an initial request:
https://stackoverflow.com/questions/24636593/woocommerce-featured-image-different-than-product-imageMarch 15, 2020 at 9:53 pm #180108
JohnParticipant
@newsprince can you check the code above? Thanks in advance.March 16, 2020 at 8:14 am #180148
Elise NoromitMemberHello,
Our support does not cover testing the third-party code. We cannot guarantee its smooth 100% working.
Best Regards
March 16, 2020 at 8:20 pm #180285
JohnParticipantSo you can’t help me, I need somehow to display a product image instead of feature image. Maybe you can implement this in the future…
March 16, 2020 at 9:44 pm #180295
Elise NoromitMemberHello,
We shall consider that however, we do not promise to implement that in the nearest future. You wuld better to find a developer who would customize that for you.
Best Regards
March 16, 2020 at 9:46 pm #180297
JohnParticipant@newsprince maybe you can help me with this, thanks in advance
-
AuthorPosts
- You must be logged in to create new topics. Login / Register