Just upgraded NextGen Gallery in my WordPress site from NextGen Version 1.6.1 to 2.0.59
after upgrade the galleries are working fine but a customization I used to get four thumbnails to show on my home page is not working.
I created a custom home page template that would show each post title and four related gallery thumbnails from appropriate gallery.
However, after the upgrade instead of the four thumbnails I see “[Not a valid template]”
The custom home page code is:
<ul>
<?php
global $post;
$myposts = get_posts('numberposts=100&order=ASC&orderby=title&category=3');
foreach($myposts as $post) :
setup_postdata($post);
?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?> </a> <?php ngg_excerpt(); ?></li>
<?php endforeach; ?>
</ul>
I had added a custom function ngg_excerpt to the theme functions. That function is still present after the upgrade and has the following code:
function ngg_excerpt()
{
//get the post content
$content_data = get_the_content();
//extract shortcode from content
preg_match("/[ngg([^}]*)]/", $content_data ,$matches);
$results = $matches[1];
//if shortcode exists in content
if (!empty($results))
{
//extract gallery id from shortcode
$gallery_id = preg_replace("/[^0-9]/", '', $matches[1]);
//$template = "gallery-compact.php";
//make sure that NextGen is loaded
if (function_exists(nggShowGallery))
{
//output gallery, showing only 4 images
echo nggShowGallery( $gallery_id, "compact", 4 );
}
}
}
The nggShowGallery appears to be included in the newer version of NextGen Gallery. Does anyone have any ideas about what might be missing or different in the version 2.0.59 that would cause this “[Not a valid template]” message?
By resetting the gallery settings using the Reset Option under Gallery > Other Options usually solves this issue.
Copy your custom template to /wp-content/plugins/nextgen-gallery/products/photocrati_nextgen/modules/ngglegacy/view/
Edit the post and double click the gallery.