Woocommerce Gallery Image Caption: Use “caption” — not “alt tag”. Keep alt tag as is

Phew! Here is the code for functions.php. add_filter( ‘woocommerce_single_product_image_thumbnail_html’, ‘change_alt_to_caption_gallery_images’, 10, 2 ); function change_alt_to_caption_gallery_images ( $wc_get_gallery_image_html, $image_id ){ $caption = get_post_field( ‘post_excerpt’, $image_id ); if ( !empty($caption) && !empty($wc_get_gallery_image_html) ) { $caption = str_replace( ‘”‘, “””, $caption ); $caption_repl=”data-caption=”” . $caption . ‘”‘; $wc_get_gallery_image_html = preg_replace( ‘/data-thumb-alt=”[^”]+”/’, $caption_repl, $wc_get_gallery_image_html ); } return $wc_get_gallery_image_html; }

Searching in categories AND custom fields

Adding the tax_query parameter to the $args array with the proper arguments will check for the category as well (untested): $args = array( ‘post_type’ => ‘product’, ‘posts_per_page’ => 15, ‘paged’ => $paged, ‘meta_query’ => array( array( ‘key’ => ‘meta_easyfatt_libero_1’, ‘value’ => ‘Men’, ‘compare’ => ‘LIKE’, ), ), ‘tax_query’ => array( array( ‘taxonomy’ => ‘product_cat’, ‘field’ … Read more