Below, you’ll find a detailed guide on how to add the NextGEN Download Gallery Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the NextGEN Download Gallery Plugin shortcode not to show or not to work correctly.
Before starting, here is an overview of the NextGEN Download Gallery Plugin and the shortcodes it provides:
"NextGEN Download Gallery is a powerful WordPress plugin that enhances your image galleries with a simple download feature. Ideal for photographers and visual artists to share their work."
- [nggtags_ext]
NextGEN Download Gallery [nggtags_ext] Shortcode
The NextGEN Download Gallery plugin shortcode ‘nggtags_ext’ is used to display galleries or albums based on tags. This shortcode accepts ‘template’, ‘images’, ‘album’, and ‘gallery’ as attributes. If ‘album’ or ‘gallery’ is specified, it will display the respective tags. The ‘template’ attribute changes the display format, while ‘images’ toggles image visibility.
Shortcode: [nggtags_ext]
Parameters
Here is a list of all possible nggtags_ext shortcode parameters and attributes:
template
– specifies the template to use for the gallery or albumimages
– determines if images should be displayed or notalbum
– indicates the specific album to showgallery
– indicates the specific gallery to display
Examples and Usage
Basic example – Show a gallery using the ‘nggtags_ext’ shortcode. In this example, we are displaying the gallery with the id ‘2’.
[nggtags_ext gallery=2 /]
Advanced examples
Display an album using the ‘nggtags_ext’ shortcode. Here, we are showing the album with the id ‘3’.
[nggtags_ext album=3 /]
Display a gallery using the ‘nggtags_ext’ shortcode with a custom template. In this example, we are displaying the gallery with the id ‘4’ and using ‘my_custom_template’ as the template.
[nggtags_ext gallery=4 template='my_custom_template' /]
Display an album using the ‘nggtags_ext’ shortcode with a custom template and specific images. Here, we are showing the album with the id ‘5’, using ‘my_custom_template’ as the template and displaying only images with ids ‘7’, ‘8’, and ‘9’.
[nggtags_ext album=5 template='my_custom_template' images='7,8,9' /]
PHP Function Code
In case you have difficulties debugging what causing issues with [nggtags_ext]
shortcode, check below the related PHP functions code.
Shortcode line:
add_shortcode('nggtags_ext', [$this, 'shortcodeTags']);
Shortcode PHP function:
function shortcodeTags($attrs, $content = '') {
$template = isset($attrs['template']) ? $attrs['template'] : '';
$images = isset($attrs['images']) ? $attrs['images'] : false;
if (!empty($attrs['album'])) {
$out = $this->nggShowAlbumTags($attrs['album'], $template, $images);
}
else if (!empty($attrs['gallery'])) {
$out = $this->nggShowGalleryTags($attrs['gallery'], $template, $images);
}
return $out;
}
Code file location:
nextgen-download-gallery/nextgen-download-gallery/includes/class.NextGENDownloadGallery.php
Conclusion
Now that you’ve learned how to embed the NextGEN Download Gallery Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.
Leave a Reply