Created
August 8, 2012 08:06
-
-
Save corsonr/3293334 to your computer and use it in GitHub Desktop.
simple trick to add rel attribute to wordpress gallery
This file contains 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 PRETTYPHOTO REL ATTRIBUTE FOR LIGHTBOX */ | |
/* ------------------------------------------------------------------*/ | |
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); | |
} |
Where should I put this line of code. Pretty please
Nice one, thanks. Still working with WP 4.5.2
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Any idea how to add title attribute in order for prettyphoto to display photo description? I have tried with this: return str_replace('<a href', '<a title="' . get_the_title() . '" rel="prettyPhoto[pp_gal]" href', $link);, but i get the post title, not the attachment title!