Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 484
Christoffer Avatar asked Feb 28 '12 09:02

Christoffer


1 Answers

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;
 }
like image 52
david Avatar answered Nov 25 '22 07:11

david