I am using NextGen gallery in a project for a client. The client wants to be able to add galleries to their posts/pages (no problem), but also wanted an excerpt of the gallery to show up anytime an excerpt of the post is displayed. The core WordPress functions do not recognize the NextGen gallery, and after hours of searching howto do this to no avail (maybe i just suck at searching) I decided to code a function that does this.
Here is my solution which shows excerpts of a NextGen gallery in a post/page excerpt:
in your themes function.php add:
//get the post content
$content_data = get_the_content()
//extract shortcode from content
preg_match("/\[ngg([^}]*)\]/", $content_data ,$matches);
$results = $matches;
//if shortcode exists in content
//extract gallery id from shortcode
$gallery_id = preg_replace("/[^0-9]/", '', $matches);
//make sure that NextGen is loaded
//output gallery, showing only 4 images
echo nggShowGallery( $gallery_id, null , 4 );
And then inside your loop just call ngg_excerpt(); wherever you want the gallery excerpt to output
Please note that the excerpt will show pagination links, which will be broken. I'm still trying to workout a solution to not display pagination links. Any insights are appreciated. I will post pagination solution once I figure it out...