Saltar navegación

[Resuelto] Displaying captions in the lightbox display for gallery images

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:
Displaying captions in the lightbox display for gallery images

Solution:
You will have to add the custom JS workaround to display the captions with the lightbox added by gallery image.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/displaying-captions-in-the-lightbox-display-for-gallery-images/#post-2364257

Relevant Documentation:

This support ticket is created 4 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Zona horaria del colaborador: Asia/Kolkata (GMT+05:30)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por JoshuaD7497 4 years ago.

Asistido por: Minesh.

Autor
Mensajes
#2363851

I need to display captions on my gallery images in the lightbox display for each image.

I found a couple of support pages where users had the same requirement, but I couldn't implement the suggested solutions. There were hidden screenshots and links in the support pages which I couldn't view, which probably didn't help.

e.g. https://toolset.com/forums/topic/display-caption-image-in-lightbox/
and https://toolset.com/forums/topic/display-captions-with-lightbox-images/

#2364257

Minesh
Colaborador

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I've added the following ID to my gallery block: my-gallery
- Please check the following screenshot: enlace oculto

And then, I've added the following code to the JS box of my content template:
Screenshot: => enlace oculto

jQuery(function ($) {
    var gallery = $('#my-gallery')
    gallery.find('li').each(function () {
        var caption = $(this).find('figcaption').text()
        
var link = $(this).find('a')
        link.attr('data-title', caption)
    })
});

If you check on frontend, I can see when you click on first three images which have captions setup, it does display the caption with lightbox: enlace oculto

Here is the sandbox site login if you may require:
- enlace oculto

#2364301

With your advice, my issue is resolved now. Thank you!