Improve Gallery Handling
It's a bit rough right now (see #93 for example) and we just use amp-carousel for all galleries.
- [ ] Try to respect the
typeandsizesettings for the gallery. - [ ] Make sure images have sizes.
- [ ] Maybe incorporate
amp-lightbox. - [ ] Make sure the
get_postsget picked up by object cache (i.e.suppress_filters). - [ ] Add captions.
As a suggestion, it'd be nice to add a filter to the URL on the images being added to the gallery, so CDN or other manipulations could be done on them.
That seems like a good idea, although, shouldn't CDNing the URL happen at a lower level like wp_get_attachment_url? What other manipulations would you like to do?
Can I add some suggestions?
When the default wordpress gallery has captions and links they aren't translated to AMP version. You can check an example by the end of this link, before sharing buttons. That's affiliate links and are fundamental to this website.
- [ ] add link to image carousel
- [ ] add caption to image carousel
Thanks!
Another vote for captions by pako69 here.
See the "Text Overlay" section here: https://ampbyexample.com/advanced/image_galleries_with_amp-carousel/
I'll take a look tomorrow, I'll study the code and try to submit a PR. My priority are the links in the carousel images.
I'm not a Wordpress programmer but I was looking how to get alt attribute to add as caption and I found this:
$alt_txt = trim(get_post_meta($attachment_id, '_wp_attachment_image_alt', true));
But when I try to use it under AMP_Gallery_Embed_Handler class it return a empty string. I was trying to call it right here: https://github.com/Automattic/amp-wp/blob/master/includes/embeds/class-amp-gallery-embed.php#L91
From the above, it looks as if captions in galleries hasn't yet been implemented. Are there any thoughts on when this might be implemented?
A WordPress VIP client is asking about this.
Any updates on captions? It is the only thing making my AMP page incomplete.
As of upcoming 1.0 the galleries support lightboxes and the carousel is optional, allowing you to use whatever your active theme is doing since the templates get served in AMP.