I want to get a list of galleries of a certain album. Than I would create a link to this galleries. How do I get the list of galleries in PHP?
I saw that there is some code like
global $nggdb;
$gallery = $nggdb->get_gallery ($galleryID, 'sortorder', 'ASC', true, 0, 0);
but is there some documentation which functions I could use?
Put this into your page template:
<?php
global $nggdb;
$galleries = array();
$album = $nggdb->find_album(1);
foreach( $album->gallery_ids as $galleryid ){
$gallery = $nggdb->find_gallery($galleryid);
$galleries[$galleryid]['title'] = $gallery->title;
$galleries[$galleryid]['url'] = get_bloginfo('url') . '/portfolio/?album=all&gallery=' . $galleryid;
}
foreach($galleries as $category){
echo '<a href="' . $category['url'] . '">' . $category['title'] . '</a><br />';
}
?>
You have to adapt the album id and you need to link to a page where the album code of NGG is active.
All functions can be found in /wp-content/plugins/nextgen-gallery/lib/ngg-db.php.