Thanks for the reply.
I actually implemented a slightly different approach. I added the following code to my functions.php file:
add_filter(‘the_content’, ‘addshadowboxrel’, 12);
add_filter(‘get_comment_text’, ‘addshadowboxrel’);
function addshadowboxrel ($content)
{ global $post;
$pattern = “/<a(.*?)href=(‘|\”)([^>]*).(bmp|gif|jpeg|jpg|png)(‘|\”)(.*?)
>(.*?)<\/a>/i”;
$replacement = ‘<a$1href=$2$3.$4$5 rel=”post-‘.$post->ID.'”$6>$7’;
$content = preg_replace($pattern, $replacement, $content);
return $content;
}
This allows fancy box to use the REL tag. Works like a charm – it now scrolls through only images in a post which is a nice side effect.