Tagged: gallery
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?
Hey 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 line var imgTitle = $(this).attr('title');
to this var imgTitle = $(this).attr('alt');
Best regards,
Mike
… thank´s Mike!
Hi,
Did you need additional help with this topic or shall we close?
Best regards,
Jordan Shannon
… yes you can close!
I implemented Mike’s tip and used the Alt field
Hi,
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