From ed17599da13d59a7a40bef85864e88119c1e4530 Mon Sep 17 00:00:00 2001 From: Stephan Date: Tue, 6 Aug 2019 16:05:50 +0200 Subject: [PATCH] Update api.js --- js/api.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/js/api.js b/js/api.js index 2988e37..be0f16e 100644 --- a/js/api.js +++ b/js/api.js @@ -82,7 +82,12 @@ if( ! $img.parent().has("figcaption") ) { var $caption = $("
"+caption+"
").addClass("wp-caption-text media-license__figcaption"); - $img.after($caption); + // image is wrapped with link + if( $img.parent("a").length == 1 ) { + $img.next("figure").append($caption); + } else { + $img.after($caption); + } } else { $img.parent().find("figcaption").addClass("media-license__figcaption").html( caption ); }