Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm using the popular NextGen Gallery / nggallery plugin to handle photo albums and galleries on my site.

I can arrange photos into a album and display it using a shortcode no problem, where I'm struggling is that I want to create a master "Photo Galleries" page which will show all of the photo Albums on the site.

Any advice / ideas on how to do this? The only vaguely useful suggestion I've found online thus far is to re-arrange the albums so that I have a master albums which has everything else as a sub albums. This feels very suboptimal as each gallery / albums will need to be re-arranged on upload.

I found a duplicate of this question elsewhere on the stack network - http://webmasters.stackexchange.com/questions/1858/how-to-show-all-albums-in-wordpress-nextgen-gallery but that one doesn't have an answer and hasn't been migrated to here.

Thanks Jona

share|improve this question

closed as off-topic by Mark Kaplun, birgire, Pieter Goosen, G. M., Johannes Pille Sep 28 at 12:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Your question should be specific to WordPress. Generic PHP/JS/HTML/CSS questions might be better asked at Stack Overflow or another appropriate site of the Stack Exchange network. Third party plugins and themes are off topic." – Mark Kaplun, birgire, Pieter Goosen, G. M., Johannes Pille
If this question can be reworded to fit the rules in the help center, please edit the question.

    
Have you tried this? wordpress.org/support/topic/… –  Matthew Boynes Feb 23 '13 at 20:30
    
doesn't your shorcode contain an ID ? so why not create a custom page template and include all there? (i know this is not an answer, but cannot seem to comment) –  bboy Mar 1 '13 at 10:59
    
@bboy You will be able to leave comments when you gain some reputation on site. –  Rarst Mar 1 '13 at 12:28

1 Answer 1

I have not a ready solution, but small hints.

You get all albums from nggallery with a small sql select. This get a array with all data to the album. If you have the right fields, change the * and use only the fields, there store your data.

    global $wpdb; 
    $albumlist = $wpdb->get_results("SELECT * FROM $wpdb->nggalbum ORDER BY id");

After this result you can create in a template a list with this data, like the name as example.

    foreach( $albumlist as $album ) {
        echo '<b>ID: ' . $album->id . ' Name: ' . $album->name . '</b><br>';
    }

Before you play with a sql select please play woth the global var and the functions of nextgen. The important var of ngg is $nggdb. About this you can use many methods to the class of ngg, lik get_used_galleries().

I know about this method. Please check the example source.

global $nggdb;
$galleries = array();
/* find all galleries */
foreach( $nggdb->find_all_galleries() as $gallery ) {
   // check the array $gallery
   // $gallery: name, path(wp-content), title, previewpicID, author
   array_push( $galleries, $gallery->gid );
}
/* create a temporary album with all galleries */
echo nggCreateAlbum( $galleries, 'grid' );
share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.