Can I change Hover Image?
-
Can I change hover image with custom css? I want to change hover image to last image instead of 2nd / second image.
Hello,
No, it is not possible to do it with CSS. You can drag and drop images in the gallery and set whatever you want as shown: https://prnt.sc/iyyjse
If you have any questions feel free to contact us.
Best Regards
Yeah I know about drag and drop images. But I have about 6000 products that take a lot of times. Maybe you can make this feature in the future?
Try to add the following PHP code snippet to the child theme functions.php file to do this
function woodmart_hover_image() {
global $product;
$attachment_ids = $product->get_gallery_image_ids();
$hover_image = '';
$id = end( $attachment_ids );
if ( ! empty( $id ) ) {
$hover_image = woodmart_get_product_thumbnail( 'woocommerce_thumbnail', $id );
}
if( $hover_image != '' && woodmart_get_opt( 'hover_image' ) ): ?>
<div class="hover-img">
<a href="<?php echo esc_url( get_permalink() ); ?>">
<?php echo ( $hover_image ); ?>
</a>
</div>
<?php endif;
}
Woah that’s works! Xtemos are the best! Thank you very much!
You are welcome. If you have any questions feel free to contact us.
Best Regards
The topic ‘Can I change Hover Image?’ is closed to new replies.