Hi,
Can anyone help me on this, on how to filter the link to in WP Gallery Shortcode? I found this code snippet online.
if(!function_exists('add_gallery_lightbox')) :
function add_gallery_lightbox($link) {
global $post;
if( $link['link'] == 'file' ) :
$link = str_replace('<a href', '<a class="lightbox" href', $link);
endif;
return $link;
}
endif;
add_filter('wp_get_attachment_link', 'add_gallery_lightbox');
Not sure if this code is correct in filtering the link to “file”
if( $link[‘link’] == ‘file’ ) :
if link to is linked to file then it will add class lightbox
I hope someone can help me on this.
Thank you!