Fix caption on thumbnails as well as main image

This commit is contained in:
Mike Jolley 2017-04-11 12:08:04 +01:00
parent d81493cc52
commit 98b21b6be7
2 changed files with 5 additions and 7 deletions

View File

@ -24,8 +24,7 @@ global $post, $product;
$columns = apply_filters( 'woocommerce_product_thumbnails_columns', 4 );
$post_thumbnail_id = get_post_thumbnail_id( $post->ID );
$full_size_image = wp_get_attachment_image_src( $post_thumbnail_id, 'full' );
$thumbnail_post = get_post( $post_thumbnail_id );
$image_title = $thumbnail_post->post_excerpt;
$image_title = get_post_field( 'post_excerpt', $post_thumbnail_id );
$placeholder = has_post_thumbnail() ? 'with-images' : 'without-images';
$wrapper_classes = apply_filters( 'woocommerce_single_product_image_gallery_classes', array(
'woocommerce-product-gallery',

View File

@ -13,7 +13,7 @@
* @see https://docs.woocommerce.com/document/template-structure/
* @author WooThemes
* @package WooCommerce/Templates
* @version 3.0.0
* @version 3.0.2
*/
if ( ! defined( 'ABSPATH' ) ) {
@ -28,8 +28,7 @@ if ( $attachment_ids && has_post_thumbnail() ) {
foreach ( $attachment_ids as $attachment_id ) {
$full_size_image = wp_get_attachment_image_src( $attachment_id, 'full' );
$thumbnail = wp_get_attachment_image_src( $attachment_id, 'shop_thumbnail' );
$thumbnail_post = get_post( $attachment_id );
$image_title = $thumbnail_post ? $thumbnail_post->post_content : '';
$image_title = get_post_field( 'post_excerpt', $attachment_id );
$attributes = array(
'title' => $image_title,