Now i have this snippet in my functions.php
/**
* Add rel to links.
*/
function add_rel_to_gallery($link) {
return str_replace('<a href=', '<a data-fancybox="true" rel="group" href=', $link);
}
add_filter( 'wp_get_attachment_link', 'add_rel_to_gallery' );
Every link in gallery has rel="group", but actually i want get something like that:
rel="group-$gallery-id"
How do this?
What is gallery id?
<div id="gallery-1" class="gallery galleryid-1457 gallery-columns-5 gallery-size-thumbnail">
<dl class="gallery-item">
<dt class="gallery-icon landscape">
<a data-fancybox="true" rel="group" href="smt.jpg"><img src="smt.jpg" class="attachment-thumbnail" alt="ult-collection_sh10154" height="150" width="150"></a>
</dt></dl><dl class="gallery-item">
<dt class="gallery-icon landscape">
<a data-fancybox="true" rel="group" href="smt.jpg"><img src="smt.jpg" class="attachment-thumbnail" alt="ult-collection_sh10153_1" height="150" width="150"></a>
</dt>
</dl>
</div>
In this output gallery id is 1457.
I need gallery id (or something that can grouped images from one gallery to one rel group) for create fancybox groups:
Note: ID's are single use and are only applied to one element. Galleries are created from elements who have the same "data-fancybox-group" or "rel" attribute value.