There’s a function defined in nggfunctions.php
that you can use directly in the template page:
/* nggShowRandomRecent($type, $maxImages, $template, $galleryId) - return recent or random images
*
* @access public
* @param string $type 'id' (for latest addition to DB), 'date' (for image with the latest date), 'sort' (for image sorted by user order) or 'random'
* @param integer $maxImages of images
* @param string $template (optional) name for a template file, look for gallery-$template
* @param int $galleryId Limit to a specific gallery
* @return the content
*/
Or you can use this shortcode, defined in the shortcodes.php
file:
/**
* Function to show a gallery of random or the most recent images with shortcode of type:
*
* [random max="7" template="filename" id="2" /]
* [recent max="7" template="filename" id="3" mode="date" /]
* where
* - max is the maximum number of random or recent images to show
* - template is a name for a gallery template, which is located in themefolder/nggallery or plugins/nextgen-gallery/view
* - id is the gallery id, if the recent/random pictures shall be taken from a specific gallery only
* - mode is either "id" (which takes the latest additions to the databse, default)
* or "date" (which takes the latest pictures by EXIF date)
* or "sort" (which takes the pictures by user sort order)
*
* @param array $atts
* @return the_content
*/