I really like Lightbox but do not want to go through ### posts to update each and every image.... Is there a way to do this automatically?
Thought to add the REL=Lightbox and GROUP tag automatically with the following plugin:
<?php
/*
Plugin Name: Add lightbox
*/
define("IMAGE_FILETYPE", "(bmp|gif|jpeg|jpg|png)", true);
function addlightboxrel_replace($string) {
$pattern = '/(<a(.*?)href="([^"]*.)'.IMAGE_FILETYPE.'"(.*?)><img)/ie';
$replacement = '(strstr("25"," rel=") ? "1" : "<a rel="lightbox[imagegroup]"2href="34"5><img")';
return preg_replace($pattern, $replacement, $string);
}
add_filter('the_content', 'addlightboxrel_replace');
?>
But it is not working.... any ideas?
Many thanks!