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.
Next: Top 10 Things Vuthy Loves Right Now
Other resources:
Stay updated! Sign up for email alerts whenever a new entry is posted
Add this blog feed to your reader »
NextGen Gallery: Random Photos from a Specific Gallery
Guide to NextGEN Gallery Plugin: Album and Gallery

Latest Tweets

