• Hi, I’m building a photography portfolio, and have added your lightbox.
    In the settings, I have checked the ‘show caption’ option. But no captions are showing up in the lightbox. Any idea perhaps why that could be?

    All images on the page have caption added to them in the media library.
    The option for ‘info bar’ is on too.

    In the html of the page I can see a section is added called ‘id=imageDataContainer’, with a nested div in them called ‘imageDetails’ and a deeper span called ‘titleAndCaption’. I can also see that that section sits in the ‘info bar’ below the image. But there is no content inserted into that span (in the html), so logically nothing shows up on the front end.

    (my WordPress version is the latest: 6.5.2)

    Cheers!

    • This topic was modified 6 months, 3 weeks ago by raoulunger.
    • This topic was modified 6 months, 3 weeks ago by raoulunger.
    • This topic was modified 6 months, 3 weeks ago by raoulunger.
    • This topic was modified 6 months, 3 weeks ago by raoulunger.
    • This topic was modified 6 months, 3 weeks ago by raoulunger.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor LightPress

    (@pandaboxwp)

    Hi there!

    I just tested this. For me, the captions are showing. It does sounds like you’re doing everything right:

    • Images should have a caption in the media library.
    • You should turn on ‘Show info bar’ and ‘Show caption’.

    That should be it. For me, doing just the above and otherwise using the default settings, it looks like this: https://d.pr/i/y7u1In

    Some troubleshooting questions:

    • Are you able to see that info bar on the bottom at all? id, even without caption, you should see it with page numbers and/or image title, etc. Just want to confirm if it’s the infowar that’s not showing, or just the caption on the info bar.
    • Any chance you could share a screenshot of your settings? I can try to duplicate. Maybe there’s some settings interacting in an unpredictable way.
    • Any chance you could screenshot one of your images in the media library that shows the caption?
    jalapenojuan

    (@jalapenojuan)

    Hi. I’m experiencing a similar problem.

    Here are my settings

    The picture does have a caption:

    Which shows in the post:

    But not in the lightbox:

    The post is live at: https://nandu.world/blog/2024/04/sixty-years/

    Thanks!

    Juan

    Thread Starter raoulunger

    (@raoulunger)

    Hi people from Lightpress, sorry for this late answer. I tested a few things, and I think the problem with captions not showing is due to two things (in my case at least – the problems that Jalapenojuan is having might be different).

    1
    I ‘populate’ my pages with a custom post plugin (Pods). This allows to include or exclude every separate metafield related to media files. So I can include that image, and the caption separately. I can also choose not to show the caption on the page (even though I would want it to show up in the Lightbox).
    But when an image in WordPress is inserted in the regular ‘classic’ way (in the TinYMC editor), WP wraps it in two caption tags (if a caption is filled in the media library). This means that WordPress will always show the caption if there is one. I tested your Lightbox with images that are inserted in that way, and then everything works fine (captions show up in the Lightbox).

    2
    I noticed some behaviour of your plugin that in my view is a little illogical. When I insert an image in the classical way, not only does WP wrap it in caption tags, but it also ‘prints’ the content of the caption in the html-code. So the html markup looks like this:

    <caption><img>This is the captiontext</caption>

    As said, in this way the caption is shown in the Lightbox, as expected. But I noticed that, if I alter the caption directly in the HTML markup, this altered version is shown in the Lightbox image.
    This means that apparently Lightbox does not take the caption from the original metafield directly, but rather looks at what is essentially a copy of that caption printed by WP in the markup.

    This means a number of things: firstly, captions will not work when images that have catpion are inserted in the markup through custom post fields (e.g. Pods) – as is the case in my example. And secondly, we always have to show the page-version of the image together with its caption for it to show up in the Lightbox version as well. If we delete the caption in the markup after inserting the image (because for some reason we don’t want it on the page itself), it also will not show anything in the Lightbox.

    There might be technical reasons for this behaviour, but I think it would be more logical if Lightbox would look directly to the caption metafield pertaining to the image, rather than to the copy WP prints of it in the HTML markup. This would probably also solve the problems with the custom post fields.

    Plugin Contributor LightPress

    (@pandaboxwp)

    @raoulunger – Thanks for the follow up and details. To touch on the second issue first, I’m definitely open to exploring an update that looks in image meta data vs html. That’s not a common request, but it seems like a worthwhile feature. I’ll need to look at what will involved. I’ll follow up on this when I’ve had a chance to do so.

    On your original issue with captions not showing…..to confirm, do we think the reason is this issue with caption meta data vs captions-in-html? Sounds like maybe your images are inserted without caption-in-html, and that may be the reason it’s not showing. So the solution would be adding the feature above.



    @jalapenojuan – Thanks very much for the detailed post and the screenshots. Your issue is puzzling. Based on what I see, captions should be working. I retested to confirm it works as expected. For me, using image with a caption like your, with your lightbox settings, the caption does show. I can play around with things a bit more to see if I can find a way to duplicate. Just to be sure we’re on the same page, what are you using to insert the images/gallery? Is that the block editor and a core Gallery block, or something else? Based on how the gallery is rendered, it doesn’t look quite like I’d normally expect a Gallery block, but it could be the theme adjusting styles a bit.

    Just a heads up to both of you, I’m traveling late this week and early next week, so I really won’t dig into anything until middle next week.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Caption not showing up’ is closed to new replies.