Tagged: 

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #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?

    #1307621

    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

    #1307781

    … thank´s Mike!

    #1307796

    Hi,

    Did you need additional help with this topic or shall we close?

    Best regards,
    Jordan Shannon

    #1309895

    … yes you can close!
    I implemented Mike’s tip and used the Alt field

    #1309914

    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

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Display the image caption in the Horizontal Gallery’ is closed to new replies.