Explore » Food & Cooking » | Shopping » | Health & Fitness » | Beauty »

Quick Guide to NextGEN Gallery Common Codes


[album=#,extended] or [album=#,compact]
- Create a page and put this code in. Change the # to the ID of your album. This page is where galleries in that album will show up.
The compact style will only show the photo gallery cover, name, and number of pictures.
The extended style will also show the gallery’s description.

[gallery=#]
- Put in pages or post where you want a specific photo gallery to show up. Change # to the ID of the gallery.

With the NextGen Gallery widget, you can display random photos, recent photos, or a slideshow in your sidebar. If your theme doesn’t support widgets or you just don’t like using widgets (like me), below is the manual code to display these in your sidebar or anywhere else in your template. You still need to activate your widget plugin for this to work.

To show a slideshow from a specific gallery:

<?php
if (function_exists("nggSlideshowWidget"))
{nggSlideshowWidget($galleryID,$Width,$Height);}
?>

To show random images (pulled from your entire NextGen gallery):

<?php
if (function_exists("nggDisplayRandomImages"))
{nggDisplayRandomImages($number_of_pic,$Width,$Height);}
?>

To show recent images (pulled from your entire NextGen gallery):

<?php
if (function_exists("nggDisplayRecentImages"))
{nggDisplayRecentImages($number_of_pic,$Width,$Height);}
?>

For more control over random images or recent images, like specifying galleries to include or exlucde, you need to edit the nggwidget.php file (found in /wp-content/plugins/nextgen-gallery/). Instead of messing with the existing code, I like to copy the code for the function I want to modify (such as the nggDisplayRandomImages function), paste it, rename it, and modify from there. I would then call upon this new function in my templates:

<?php
if (function_exists("myNewFunctionBasedontheOldFunction"))
{myNewFunctionBasedontheOldFunction($number_of_pic,$Width,$Height);}
?>

For more information about modifying nggwidget.php, read my tutorial on how to manually display a photo from a specifc NextGen gallery.


Previous: Thanksgiving Flowers: Teleflora Coupon and Promo Codes

Next: Top 10 Things Vuthy Loves Right Now

Tags: ,



Other resources:


  • Vuthy
    Hi Kit,

    That function call is hard-coded in nggwidget.php I believe, meaning it's written to act a certain way and show a certain layout. You would have to edit that file and rewrite the code to do what you want to do.

    I modified another function in that file to show what I wanted. You can read more about it here:
    http://www.vuthy.com/blog/2008/11/16/nextgen-ga...
  • does anyone know how to use nggDisplayRecentImages but link to the gallery page the image is from rather than open it in lightbox?
  • Oh whoops, the PHP was stripped out. You can use echo nggShowSlideshow($galleryID, $width, $height)
  • You can also display the slide show directly in your template (anywhere you want, without activating widgets) by using . It's documented in the nggfunctions.php file :D
  • Thank you for the information and the help with this plugin. But why do my images open in a browser window instead of a sideshow? The php script example you provided works great, but there is no slideshow effect when you click the images, why?
blog comments powered by Disqus
Categories

EventCalendar:

November 2008
Sun Mon Tue Wed Thu Fri Sat
 1
2345678
9101112131415
16171819202122
23242526272829
30EC
    • No events.
Dugg:

Clicky Web Analytics