wordpressnextgen-gallery

Wordpress NextGEN loop through images from specific album


I would like to loop through the images of a specific album in NextGen.

I want to use a NextGen album to create a banner slideshow in the themes header.php. Something like:

loop through images in album = x:
$src = src of image
$title = title of image
echo $src and $title

How to do this?

Found a solution:

global $nggdb;
$gallery = $nggdb->get_gallery(8, 'sortorder', 'ASC', true, 0, 0);
foreach($gallery as $image) {
    echo $image->imageURL;
    echo $image->alttext;
    echo $image->description;
 }

All other $image attributes can be printed aswell


Solution

  • Answering the question with zvinxs solution:

    global $nggdb;
    $gallery = $nggdb->get_gallery(8, 'sortorder', 'ASC', true, 0, 0);
    foreach($gallery as $image) {
        echo $image->imageURL;
        echo $image->alttext;
        echo $image->description;
     }