Okay, here's an alternative solution that doesn't require Alex to add anything to the NextGen code *AND* will survive NGG plugin updates. It's an alteration of the gallery.php code so there's no need to exclude the Preview Image or alter the NextGen core code to force a display of excluded images in the first place. Neat huh??
1. Replace the standard NextGen gallery presentation with a custom one in your theme by copying the "/wp-content/plugins/nextgen-gallery/view/gallery.php" file to "/wp-content/themes/your-theme/nggallery/gallery.php" (You may have to create the "nggallery" folder in your theme.)
2. Now I really customized my gallery, so a lot of the standard code has been removed & changed around in what's below. The important bits are the lines between "if(!empty($gallery))" and "foreach($images as $image)" as well as the "if($PreviewImgPath==$image->imageURL) { continue; }" line...
if(!empty($gallery))
{
global $wpdb;
$results = $wpdb->get_results("SELECT ng.path, np.filename FROM wp_ngg_pictures np, wp_ngg_gallery ng WHERE np.galleryid=ng.gid AND np.galleryid=" . $gallery->ID . " AND np.pid=ng.previewpic",ARRAY_A);
if(!empty($results[0]['path']) && !empty($results[0]['filename']))
{ $PreviewImgPath = get_bloginfo('url') . '/' . $results[0]['path'] . '/' . $results[0]['filename']; }
foreach($images as $image)
{
if($PreviewImgPath==$image->imageURL) { continue; }
if($image->hidden) { continue; }
$ImageCode .= '<div style="float:left; padding:5px;">' .
'<a href="' . $image->imageURL . '" title="' . $image->description .
'" ' . $image->thumbcode . '>' . '<img title="' . $image->alttext .
'" alt="' . $image->alttext . '" src="' . $image->thumbnailURL .
'" ' . $image->size . ' /></a>' .
'</div>';
}
if($pagination)
{ $pagination = '<br style="clear:both;" />' . $pagination; }
echo '<div id="galLery2">' . $ImageCode . $pagination . '</div>';
}
The code above basically tells the gallery to display everything *BUT* the Preview Image. This is done via a wpdb query to get the gallery's Preview Image URL, comparing that to each image in the $gallery array, then skipping over the image if the URLs match.
Granted, the wpdb query is a bit kludgy, but it's the only way I could figure to get the Preview Image info from the gallery.php page. And I looked A LOT. Thanks to GitHub:Gist for getting me started in that direction. However, if anyone has any cleaner way of doing so, I'm happy to hear. Otherwise, hope this helps!