WordPress.org

Ready to get started?Download WordPress

Forums

WooCommerce - excelling eCommerce
[resolved] Display gallery's image title below thumbnail (2 posts)

  1. daledude
    Member
    Posted 2 years ago #

    Anybody know how to display the image title for the non-featured images in the gallery below the thumbnail? It just shows the thumbnail by default, and you can hover your mouse over the thumbnail to see the image title description. But, obviously, there is no such thing as hover on mobile/tablet. So you cannot see the product's additional image name at all without clicking and viewing the popup gallery.

    The code for it is in woocommerce/templates/single-product/product-thumbnails.php

    printf( '<a href="%s" title="%s" rel="thumbnails" class="%s">%s</a>', wp_get_attachment_url( $attachment->ID ), esc_attr( $attachment->post_title ), implode(' ', $classes), wp_get_attachment_image( $attachment->ID, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ) ) );

    They use %s for everything in the line... so makes it kind of difficult for me to figure out how to add a new p or span or something in there to house the title.

    http://wordpress.org/extend/plugins/woocommerce/

  2. daledude
    Member
    Posted 2 years ago #

    I figured it out on my own. Here's my revised code from above:

    printf( '<li><a href="%s" title="%s" rel="thumbnails" class="%s">%s <span>%s</span></a></li>', wp_get_attachment_url( $attachment->ID ), esc_attr( $attachment->post_title ), implode(' ', $classes), wp_get_attachment_image( $attachment->ID, apply_filters( 'single_product_small_thumbnail_size', 'shop_thumbnail' ) ), esc_attr( $attachment->post_title ) );

    That last esc_attr is the one that does it. And I added the extra %s inside of a span, but you can use any other that you want, p, div, etc.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.