NextGEN Gallery

I am working on porting over my photos from my coldfusion site this morning. After looking around for a good wordpress plugin to do what I wanted I settled on NextGEN Gallery. Great plugin out the box. I did a little tinkering with the album-compact.php to make my own template. I did not like the linking structure it creates out the box. I really wanted to replicate the links I had on my old coldfusion site (/photos/album name) I created a new album-damon.php and inserted the following code:

<!– List of galleries –>
<?php foreach ($galleries as $gallery) : ?>

<div class=”ngg-album-compact”>
<div class=”ngg-album-compactbox”>
<div class=”ngg-album-link”>
<a class=”Link” href=”/photos/<?php echo str_replace(” “, “”,strtolower($gallery->title)) ?>”>
<img class=”Thumb” alt=”<?php echo $gallery->title ?>” src=”<?php echo $gallery->previewurl ?>”/>
</a>
</div>
</div>
<h4><a class=”ngg-album-desc” title=”<?php echo $gallery->title ?>” href=”/photos/<?php echo str_replace(” “, “”,strtolower($gallery->title)) ?>”><?php echo $gallery->title ?></a></h4>
<p><strong><?php echo $gallery->counter ?></strong> <?php _e(‘Photos’, ‘nggallery’) ?></p>
</div>

<?php endforeach; ?>

Now I call this template on my Album page using:

[ album id=x template=damon] (no space before of course)

2 Responses To  “NextGEN Gallery”
  • Dan-Inge

    Did you make an page for each gallery?
    Or did the links work just after doing that? cause I can't seem to make it work without making pages for my galleries.
    Hope you can help me.

  • xge

    Thank you so much for this piece of code.
    I've been looking for the last two hours for the proper $gallery variable.

Leave A Reply