Tagged: gallery
-
AuthorPosts
-
June 24, 2021 at 2:25 pm #1307315
Hello and thank´s for the new Horizontal Gallery – it´s much better than the old one!
But tell me: How can I display the image caption underneath each image (not in the lightbox – in the Horizontal Gallery)?With the following function I can display the image title:
function horizontal_gallery_subline(){ ?> <script> (function($){ $(window).load(function() { $('.av-horizontal-gallery-link').css('bottom', '30px'); $('.av-horizontal-gallery-img').each(function(){ var imgTitle = $(this).attr('title'); $(this).after('<p class="text-under-image">' + imgTitle + ' '); $(this).css({ 'padding-bottom' : '20px', 'background-color' : 'transparent', }); $('.text-under-image').css({ "text-align": "center", "margin": "-20px 0", "color": "#000", }); }); }); })(jQuery); </script> <?php } add_action('wp_footer', 'horizontal_gallery_subline');… how can I display the cation instead of the title?
June 28, 2021 at 12:11 am #1307621Hey frankeee,
Thank you for your patience, unfortunately, your script above can not be modified to show the caption field because only the Title field & Alt field are passed to the published element. If you want to show the alt field instead you can change this linevar imgTitle = $(this).attr('title');to thisvar imgTitle = $(this).attr('alt');Best regards,
MikeJune 28, 2021 at 4:31 pm #1307781… thank´s Mike!
June 28, 2021 at 5:43 pm #1307796Hi,
Did you need additional help with this topic or shall we close?
Best regards,
Jordan ShannonJuly 13, 2021 at 9:16 am #1309895… yes you can close!
I implemented Mike’s tip and used the Alt fieldJuly 13, 2021 at 11:05 am #1309914Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘Display the image caption in the Horizontal Gallery’ is closed to new replies.
