Please share the URL to an AMP page where we can see the issue.
Did you select the “Add lightbox effect” toggle when adding image blocks? Or are you using the Classic Editor instead of the Block Editor?
See also this issue: https://github.com/ampproject/amp-wp/issues/3579
I’m using the classic editor
Please share the underlying HTML markup in the post editor (e.g. from the HTML tab) for an example image that has this issue.
<a href="https://expertopc.com/wp-content/uploads/2020/04/vulkan-run-time.jpg"><img src="https://expertopc.com/wp-content/uploads/2020/04/vulkan-run-time.jpg" alt="vulkan-run-time-libraries" width="800" height="500" /></a>
That website uses the same jannah theme I use and lightbox is working on amp pages
https://hardwaresfera.com/noticias/hardware/lenovo-legion-placa-base-intel/amp/
-
This reply was modified 5 years, 1 month ago by
ghost51.
-
This reply was modified 5 years, 1 month ago by
ghost51.
Well, one solution would be to change the markup to be as follows:
<img src="https://expertopc.com/wp-content/uploads/2020/04/vulkan-run-time.jpg" alt="vulkan-run-time-libraries" width="800" height="500" lightbox />
Remove the link wrapping the image and add lightbox
attribute to the img
.
Doing this manually for every image would be not advisable, so I recommend writing a plugin that would do this automatically for each image on AMP responses. Is that something you can do?
I have no idea how to create a plugin like that 🙁
Ok, I’ll put one together for you.
This is also something that should probably be part of the AMP plugin as a whole so I’ll file an issue.
thank you very much @westonruter
@juangose Here’s a plugin for you to try: https://gist.github.com/westonruter/fefdcda37df7bde61c7b0f690fafc01c
Installation instructions: https://gist.github.com/westonruter/6110fbc4bef0c4b8c021a112012f7e9c
Every image that is contained by a link pointing to the same image URL is automatically converted into a lightbox.
I’ve filed an issue to make this part of the AMP plugin itself: https://github.com/ampproject/amp-wp/issues/4591
I installed the plugin and lightbox is finally working on AMP pages as expected. Thanks a lot @westonruter