Add JQuery LightBox in WordPress Gallery

Yūjin kon’nichiwa (友人こんにちは) (Hello Friends in Japanese), Today I am going to talk Little about the WordPress Default Gallery and will show you how to get the JQuery Lightbox effect on the WordPress Gallery.
As we all know WordPress Have it’s default Gallery Feature with shortcode. Its a very simple and useful feature given by WordPress. But while using this feature I felt that it would be great if we could add the JQuery lightbox in the Gallery as default gallery links image to its original image or can a be linked to attachment page. For this idea I searched for a useful plugin and I found Pretty Photo Media, that worked perfectly for me. Download and activate the plugin.
This plugin used “rel” attribute. So I used following hook for adding the attribute. Place it in the functions.php of your current theme.

add_filter( 'wp_get_attachment_link', 'theme_prettyadd', 10, 6);
function theme_prettyadd ($content, $id, $size, $permalink, $icon, $text) {
$content = preg_replace("/<a/"," return $content;

Now, Insert your gallery in post or page. While inserting gallery one thing you have to check it you need to change Link To In Gallery Settings Option to “Media File”. If you are done with all things then refresh your gallery page and there you are. The gallery is lightbox enabled.
Comment if you have any question or you can also share your view for this post.