Skip to content

Instantly share code, notes, and snippets.

@cwoodley
Created April 16, 2014 06:43
Show Gist options
  • Select an option

  • Save cwoodley/10818419 to your computer and use it in GitHub Desktop.

Select an option

Save cwoodley/10818419 to your computer and use it in GitHub Desktop.
Nextgen Gallery ordered list of galleries with thumbnails
<ul>
<?php
global $wpdb, $nggRewrite, $nggdb;
$galleries = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."ngg_gallery ORDER BY gid ASC", ARRAY_A);
foreach ( $galleries as $gallery ) {
$previewpic = $gallery['previewpic'];
$thumbnail = $nggdb->find_image($previewpic);
$thumbnailUrl = $thumbnail->thumbURL;
?>
<li>
<a href="<?php get_bloginfo( 'url' ); ?>/?p=<?php echo $gallery['pageid']; ?>">
<img src="<?php echo $thumbnailUrl; ?>" alt="<?php echo $gallery['title']; ?>" />
<br>
<?php echo $gallery['title']; ?>
</a>
</li>
<?php
}
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment