Skip to content

Instantly share code, notes, and snippets.

@gasatrya
Forked from corsonr/Add rel attribute to wordpress gallery
Last active December 17, 2015 03:58
Show Gist options
  • Save gasatrya/5546948 to your computer and use it in GitHub Desktop.
Save gasatrya/5546948 to your computer and use it in GitHub Desktop.
Add rel attribute to WordPress gallery
<?php
add_filter('wp_get_attachment_link', 'rc_add_rel_attribute');
function rc_add_rel_attribute($link) {
global $post;
return str_replace('<a href', '<a rel="prettyPhoto[pp_gal]" href', $link);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment