Show caption under product gallery in WooCommerce

旧巷老猫 提交于 2019-12-02 04:52:54

问题


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:


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 )


来源:https://stackoverflow.com/questions/39592557/show-caption-under-product-gallery-in-woocommerce

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!