I got some help from Benjamin at the WordPress support forums
The solution I ended up with is the following:
global $nggdb;
$galleries = array();
$children = get_children("post_parent=$post->ID");
foreach($children as $kid) {
print_r($kid);
$page_id = $kid->ID;
$album_mapper = C_Album_Mapper::get_instance();
$albums = $album_mapper->find_all(array('pageid = %s', $page_id), TRUE);
foreach ($albums as $albumMap) {
$albumID = $albumMap->ID();
After finding the albumID, I begin finding the galleries in this album
$album = $nggdb->find_album($albumID);
if($album) {
foreach( $album->gallery_ids as $galleryid ){
$gallery = $nggdb->find_gallery($galleryid);
$image = $nggdb->find_image( $gallery->previewpic );
$galleries[$galleryid]['title'] = $gallery->title;
$galleries[$galleryid]['url'] = home_url() . $post->post_name . "https://wordpress.stackexchange.com/" . $kid->post_name . '/?album=all&gallery=' . $galleryid;
$galleries[$galleryid]['image'] = ($image->thumbURL) ? '<img src="' . $image->thumbURL . '" />' : '';
}
$i = 1;
foreach($galleries as $category){
echo '<div class="galleryContainer">'
. '<a href="' . $category['url'] . '" class="galleryImage">'
. $category['image']
. '<div class="galleryTitle">'
. $category['title']
. '</div>'
. '</a>'
. '</div>';
if ($i++ == 3) break;
}
} else {
echo 'No galleries at this time, sorry :/';
}
}
}
I hope this will help others, it works for me 🙂