The “NextCellent Random Image” (ngg-randomimage) Plugin adds to the Plugin NextCellent-Gallery or to NextGen-Gallery Version 1.x (NOT compatile with the recent version 2.x!) the following functions:
- A shortcode for displaying a random selected image from a Nextcellent (or Nextgen 1.x) gallery
- A Template for a “singlepic” from a NextCellent-Gallery with a caption from the picture properties (set in the gallery settings)
The basis of both functions is the
[ singlepic ] shortcode from NextCellent-Gallery.
This plugin requires the plugin “NextCellent gallery” to be installed. NextCellent gallery is a fork of the Version 1 of the very popular Nextgen Gallery plugin. The recent version 2 of NextGen-Gallery is incompatible to the version 1 but NextCellent-gallery is a compatible successor.
Insert of a random picture from a gallery
The new short code
[ randomimage galleryid=65 w=600 ] shows a random selected picture from the NextCellent-Gallery with the ID 65 with 600 pixel picture width. “galleryid” is a mandandory parameter, all others are optional. Mostly, it makes sense to define at least the picture width.
The possible parameter of
[ randomimage ] are equal to
[ singlepic ], with the exception that “id” is replaced by “galleryid”.
Hint: With template=caption randomimage shows a caption to the picture. More information are contained in the following section.
Singlepic or randomimage with captions
First, to add simply a caption to a singlepic, this plugin is not necessary, simply write
[ singlepic id=387 w=600 ] This is the caption.
[ /singlepic ].
ngg-randomimage adds a new template to the NextCellent-Gallery wich shows a singlepic with a caption, where the caption text is taken from the picture information (“title text”) of the gallery settings. In the full screen view of the image (after clicking into it) the usually longer text from the description field is used.
[ singlepic id=2 w=320 h=240 float=none template=caption ] gives the following result:
Set an own caption format
The default caption is set in an italic font and with a little bit smaller font size as the main text. With an additional line break the cation text is separated a little bit from the main text.
Because this formatting may not fit everyones taste or every theme. So a settings dialog has been added to the plugin where the formatting of the caption can be changed.
In the formatting string %1 is the place holder for the caption text. Please be carefull also to close all HTML tags.
From the standard formatting
<em><font size=-1>%s </font></em><br> <br>
the following code will produce a bold caption:
The plugin can be installed from every WordPress installation using the plugin install function. If this is not possible, it can also be downloaded from the following link:Download