From 2e96f4ab3f918442213866c5cd3c079b3f34f612 Mon Sep 17 00:00:00 2001 From: Mike Jolley Date: Wed, 10 Apr 2019 14:38:36 +0100 Subject: [PATCH] override addCaptionHTMLFn --- assets/js/frontend/single-product.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/js/frontend/single-product.js b/assets/js/frontend/single-product.js index cb508dda777ff..5c704a54217d7 100644 --- a/assets/js/frontend/single-product.js +++ b/assets/js/frontend/single-product.js @@ -305,7 +305,15 @@ jQuery( function( $ ) { } var options = $.extend( { - index: $( clicked ).index() + index: $( clicked ).index(), + addCaptionHTMLFn: function( item, captionEl, isFake ) { + if ( ! item.title ) { + captionEl.children[0].textContent = ''; + return false; + } + captionEl.children[0].textContent = item.title; + return true; + } }, wc_single_product_params.photoswipe_options ); // Initializes and opens PhotoSwipe.