Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //add custom class to attachment image
- add_filter('get_image_tag_class','add_image_class');
- function add_image_class($class){
- $class .= ' attachment';
- return $class;
- }
- //add rel attribute to attachment link
- add_filter('wp_get_attachment_link', 'add_rel_to_attachments');
- function add_rel_to_attachments($link) {
- global $post;
- //check if rel already exists
- if (strpos($link, ' rel="') == false)
- return str_replace('<a href', '<a rel="lightbox" href', $link);
- else
- return $link;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement