Skip to content

Instantly share code, notes, and snippets.

View gist:dcc3f4765d41646fe279f69d789cf364
Verifying my Blockstack ID is secured with the address 1MK7NHe5i2AhTxDUm4dCs7GiopdSfZ1b7C
PeterKnight / gist:5994961
Created Jul 14, 2013
This is example code that will hide the image markup for Woocommerce products if a product does not have a thumbnail. Useful if you are displaying a service for example that doesn't have a product image.
View gist:5994961
function before_no_image_product() {
if( !has_post_thumbnail( get_the_id() ) ){
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_template_loop_product_thumbnail', 10 );
echo '<div class="no-image">';
function after_no_image_product() {
if( !has_post_thumbnail( get_the_id() ) ){