I’m using the Gallery custom field, and I’m displaying it in my template as a wordpress gallery, using the third method (gallery shortcode).
I’d like to add the ‘data-featherlight=”image”‘ attribute to the links wrapping each image.
Could you please explain how I might accomplish this?
Thank you in advance for any help 🙂
FIXED
I solved it, no worries. For anyone else wanting to implement this:
/*
Add featherlight data attribute to ACF gallery
*/
function add_featherlight_gallery_attribute( $link ) {
return str_replace( '>', ' data-featherlight="image">', $link );
}
add_filter( 'wp_get_attachment_link', 'add_featherlight_gallery_attribute', 10, 2 );