I’m looking for the same answer. Unfortunately responsive lightbox does not work with jetpack’s tiled gallery
It’s a bit of a shotgun method but you can try this in functions.php … works for me across thumbnails, tiled gallery and Woocommerce:
//Add rel=lightbox
add_filter('the_content', 'addlightboxrel', 12);
add_filter('get_comment_text', 'addlightboxrel');
function addlightboxrel ($content)
{ global $post;
$pattern = "/<a(.*?)href=('|\")([^>]*).(bmp|gif|jpeg|jpg|png)('|\")(.*?)>(.*?)<\/a>/i";
$replacement = '<a$1href=$2$3.$4$5 rel="lightbox['.$post->ID.']"$6>$7</a>';
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
Thanks for this, but is there any way to get it to use the specific image size (thumbnail, medium, large, etc..) instead of just the image url.
And the caption info if possible…