Show caption under product gallery in WooCommerce

2019-07-08 10:59发布

I'm trying to show the caption text under the thumbnail in the product page gallery. I need to show the text because there are a lot images in the gallery and each thumb is a part of an engine and the name help the user.

The code for the gallery in WooCommerce product page is:

echo apply_filters( 'woocommerce_single_product_image_thumbnail_html', sprintf( '<li data-thumb="%s">%s%s<a href="%s" class="%s lightbox" data-rel="ilightbox[product]" data-caption="%s" title="%s" alt="%s"><i class="fa-search-plus"></i></a></li>', $thumb_image, $image_html, $caption_html, $image_link, $image_class, $image_caption, $image_title, $image_alt ), $attachment_id, $post->ID, $image_class );`

How can I edit it? Or, there is any solution? Thanks

1条回答
该账号已被封号
2楼-- · 2019-07-08 11:23

Make sure that you understand sprint function working way. You could play with css position of block. This could be solution.

sprintf( '<li data-thumb="%s">%s<span style="postition:...">%s</span><a href="%s" class="%s lightbox" data-rel="ilightbox[product]" data-caption="%s" title="%s" alt="%s"><i class="fa-search-plus"></i></a></li>', $thumb_image, $image_html, $caption_html, $image_link, $image_class, $image_caption, $image_title, $image_alt )
查看更多
登录 后发表回答