Sign up ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want to add a list (like a cd track list) of names and links to all images next my nextgen gallery, how can I retrieve this list? (similar to the list in the select object in the Gallery Settings, in the gallery admin page)

share|improve this question

closed as off-topic by Mark Kaplun, Pieter Goosen, birgire, gmazzap, kaiser Sep 28 '14 at 11:10

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

If this question can be reworded to fit the rules in the help center, please edit the question.

Where do you get the data from? – toscho Dec 9 '12 at 15:06
hmmm I thought that there might be a shortcode for that.. right now I simply use a gallery shortcode in a post. I want to add it to the imagebrowser.php template, a simple list of all images in that gallery.. – Omer Dec 9 '12 at 15:35

2 Answers 2

Ok, this has worked for me.

// get the track list 
global $nggdb;
    $gallery = $nggdb->get_gallery ($galleryID, 'sortorder', 'ASC', true, 0, 0);
<div id="tracklist">
<?php foreach($gallery as $image) { ?>
<div class="single_image" id="image-<?php echo $image->pid; ?>">
    <a href="<?php the_permalink() ?>&pid=<?php echo $image->pid;?>" title="<?php echo $image->title; ?>">
        <?php echo $image->alttext; ?>
<?php } ?>
share|improve this answer

You may use a function similar to below one to retrieve a list of image properties in a Next-Gen image gallery.

function wp75475_imagelist(){

include_once( ABSPATH . 'wp-admin/includes/plugin.php' );

    return 'NextGen Gallery Plugin is needed to display imagelist';

$imagegallery = new nggdb();
$images = $imagegallery->get_gallery('cdtrack');
$imagelist = '';

foreach ($images as $image):
    $imagelist .= $image->$filename;

return $imagelist;


For a list of retrievable image properties see properties of nggImage object.


share|improve this answer
Thanks Upeksha, can I use it in imagebrowser.php ? – Omer Dec 9 '12 at 16:14
Yes, that is possible. (in /yourthemefolder/nggallery/imagebrowser.php) – Upeksha Dec 9 '12 at 16:27
I'm trying, getting no errors, but it doesn't print anything... I wrapped the code with <?php code ?> and put it at the top of the page, right below <div class="ngg-imagebrowser" id="<?php echo $image->anchor ?>"> – Omer Dec 9 '12 at 16:39
I also tried to use in a post with a plugin that allows php in posts but it didn't work yet... I also replaced "cdtrack" with the name of my gallery – Omer Dec 9 '12 at 16:57
Did you echo the function output? echo wp75475_imagelist(); – Upeksha Dec 9 '12 at 17:16

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