Skip to content

Instantly share code, notes, and snippets.

@om4james
Created May 1, 2015 04:03
Show Gist options
  • Star 10 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save om4james/f9ac85711c57f87d9449 to your computer and use it in GitHub Desktop.
Save om4james/f9ac85711c57f87d9449 to your computer and use it in GitHub Desktop.
WooCommerce wrap product images in the loop (shop/archive pages)
<?php
/**
* Shop/archives: wrap the product image/thumbnail in a div.
*
* The product image itself is hooked in at priority 10 using woocommerce_template_loop_product_thumbnail(),
* so priority 9 and 11 are used to open and close the div.
*/
add_action( 'woocommerce_before_shop_loop_item_title', function(){
echo '<div class="imagewrapper">';
}, 9 );
add_action( 'woocommerce_before_shop_loop_item_title', function(){
echo '</div>';
}, 11 );
@johnmarlow007
Copy link

Great! It worked for me.
Thanks a lot!

@mknee123
Copy link

Perfect. Just what I needed! Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment