Created
July 16, 2014 21:01
-
-
Save mateusneves/94c9e1f66b7dec2760d5 to your computer and use it in GitHub Desktop.
Add custom attributes to images links in the WordPress native gallery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter('wp_get_attachment_link', 'add_gallery_id_rel'); | |
function add_gallery_id_rel($link) { | |
global $post; | |
return str_replace('<a href', '<a class="fancybox" rel="gallery" href', $link); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment