From 20eb50312833a63015f02b0d82a833548a2bad38 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Tue, 26 Feb 2019 14:03:25 +0000 Subject: [PATCH] Add alt text to gallery thumbnail --- includes/wc-template-functions.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/includes/wc-template-functions.php b/includes/wc-template-functions.php index e03b084b942..aff8a276672 100644 --- a/includes/wc-template-functions.php +++ b/includes/wc-template-functions.php @@ -1426,6 +1426,7 @@ function wc_get_gallery_image_html( $attachment_id, $main_image = false ) { $full_size = apply_filters( 'woocommerce_gallery_full_size', apply_filters( 'woocommerce_product_thumbnails_large_size', 'full' ) ); $thumbnail_src = wp_get_attachment_image_src( $attachment_id, $thumbnail_size ); $full_src = wp_get_attachment_image_src( $attachment_id, $full_size ); + $alt_text = trim( wp_strip_all_tags( get_post_meta( $attachment_id, '_wp_attachment_image_alt', true ) ) ); $image = wp_get_attachment_image( $attachment_id, $image_size, @@ -1447,7 +1448,7 @@ function wc_get_gallery_image_html( $attachment_id, $main_image = false ) { ) ); - return ''; + return ''; } if ( ! function_exists( 'woocommerce_output_product_data_tabs' ) ) {