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
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With