Home Forums WoodMart support forum Can I change Hover Image?

Can I change Hover Image?

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #50198

    drkshdw
    Participant

    Can I change hover image with custom css? I want to change hover image to last image instead of 2nd / second image.

    #50213

    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

    #50237

    drkshdw
    Participant

    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?

    #50245

    Artem Temos
    Keymaster

    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;
    
    }
    #50271

    drkshdw
    Participant

    Woah that’s works! Xtemos are the best! Thank you very much!

    #50277

    You are welcome. If you have any questions feel free to contact us.

    Best Regards

Viewing 6 posts - 1 through 6 (of 6 total)

The topic ‘Can I change Hover Image?’ is closed to new replies.