Hi, (sorry for the edit I had it all mixed up)
Is there a way to us GP elements or similar to add a custom attribute to all image media file links? I have ACF to create a new attribute “data-sub-html” that can be filled in on the media library section where you can add title, alt text, etc.
I have a lightbox plugin that will pull data-sub-html if it’s in the link attributes (with media link set to media file) and use it as the caption on lightbox popups.
Right now the images look like this (simplified):
<a href="img/img1.jpg"> <img src="img/thumb1.jpg" /> </a>
How can I inject my attribute automatically so it becomes <a href="img/img1.jpg" data-sub-html="some html formatted text"> <img src="img/thumb1.jpg" /> </a>
Apologies if this is outside the scope of GP, let me know and I’ll return to scouring google results.
Thanks,