• Very excited to see that lightbox is now built in WordPress 6.4.
    Can anyone guide to or point how to enable lightbox (expand on click) for Featured Image in Gutenberg Query Loop Block. Hook? Many thanks ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator bcworkz

    (@bcworkz)

    I’m afraid I’ve not paid much attention to what’s new in 6.4, but it looks like Lightbox is only available for image blocks. It might be possible to include it in your own custom block, IDK.

    If a post’s excerpt that is seen in query loop includes an image block, then lightbox should be available there. (unverified)

    I’m not even sure if the WP “Lightbox” is the same as the original Lokesh Dhakar Lightbox script. If it is, as long as the necessary JS and CSS is loaded onto the page, you should be able to utilize it anywhere on a page as long as the image’s anchor link HTML includes a data-lightbox attribute value.

    While it’d be ideal to use the internal WP version, we’ve always been able to use the Dhakar script by fully following the above linked instructions, but adapting for WP use, such as enqueuing the files instead of adding JS and CSS links direct to the page’s HTML.

    I see that you are excited about the built-in solution, but I would recommend the plugin “lity” to do this: https://www.ads-software.com/plugins/lity-responsive-lightboxes/ . This plugin is very flexible and easy-to-use so whatever your specific use case is you will most likely be able to use lity.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Lightbox for featured image in loop’ is closed to new replies.