The problem is because this plugin is putting in a “-” even for non-galleries for the data-rel attribute. Doing so confuses prettyPhoto.js file into thinking both are galleries and hence enables nav bars even for 1 photo.
The fix is easy. One can either change the jquery.prettyphoto.js file (line 149) from:
galleryRegExp = /\-(?:.*)/;
to
galleryRegExp = /\gallery(?:.*)/;
Or this plugin can simply just stop using “-” for single images (non-galleries). It’s used for non-galleries to # each image in a post e.g. lightbox-1, lightbox-2,….lightbox-n, where n is the total # of images in a post. Not sure why this is necessary unless the author is making it universal so it works across the other scripts (essentially you only need to have a data-rel=”lightbox” not data-rel=”lightbox-1″..) So if u have 1 image it is called: lightbox-1. Because of this “-” prettyPhoto then thinks it is a gallery and hence shows the nav bar.
Alternatively, if you dont want to touch the author’s plugin php file nor the prettyPhoto.js file you can add a wordpress filter that looks for “lightbox-[0-9]+” and replace it with “lightbox”, stripping the “-” from the content before it is sent out to the browser. At least that way if this plugin updates your changes will still work. For example (this should work and still allow galleries to work too):
function my_the_content_filter($content)
{
$content = preg_replace('/lightbox-[0-9]+/i','lightbox',$content);
return $content;
}
add_filter( 'the_content', 'my_the_content_filter',99 );
Cheers
Kimberly