nggShowAlbum

NggShowAlbum() - return a album based on the id.

Description

nggShowAlbum( (int) $albumID, (string) $template = 'extend', (string) $gallery_template = '' ); 

Parameters (3)

0. $albumid (int)
| string $albumID
1. $template — Optional. (string) => 'extend'
$template
2. $gallery_template — Optional. (string) => ''
$gallery_template

Usage

  1. if ( !function_exists( 'nggShowAlbum' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'nextcellent-gallery/nggfunctions.php'; 
  3.  
  4. // | string $albumID 
  5. $albumid = -1; 
  6.  
  7. // (optional) $template 
  8. $template = 'extend'; 
  9.  
  10. // (optional) $gallery_template 
  11. $gallery_template = ''; 
  12.  
  13. // NOTICE! Understand what this does before running. 
  14. $result = nggShowAlbum($albumid, $template, $gallery_template); 
  15.  

Defined (1)

The function is defined in the following location(s).

/nggfunctions.php  
  1. function nggShowAlbum($albumID, $template = 'extend', $gallery_template = '') { 
  2.  
  3. // $_GET from wp_query 
  4. $gallery = get_query_var('gallery'); 
  5. $album = get_query_var('album'); 
  6.  
  7. // in the case somebody uses the '0', it should be 'all' to show all galleries 
  8. $albumID = ($albumID == 0) ? 'all' : $albumID; 
  9.  
  10. // first look for gallery variable 
  11. if (!empty( $gallery )) { 
  12.  
  13. // subalbum support only one instance, you can't use more of them in one post 
  14. //TODO: causes problems with SFC plugin, due to a second filter callback 
  15. global $wp_current_filter; 
  16. if ( isset($GLOBALS['subalbum']) || isset($GLOBALS['nggShowGallery'])) 
  17. return; 
  18.  
  19. // if gallery is submit , then show the gallery instead 
  20. $out = nggShowGallery( $gallery, $gallery_template ); 
  21. $GLOBALS['nggShowGallery'] = true; 
  22.  
  23. return $out; 
  24.  
  25. if ( (empty( $gallery )) && (isset($GLOBALS['subalbum'])) ) 
  26. return; 
  27.  
  28. //redirect to subalbum only one time 
  29. if (!empty( $album )) { 
  30. $GLOBALS['subalbum'] = true; 
  31. $albumID = $album; 
  32.  
  33. // lookup in the database 
  34. $album = nggdb::find_album( $albumID ); 
  35.  
  36. // still no success ? , die ! 
  37. if( !$album ) 
  38. return __('[Album not found]', 'nggallery'); 
  39.  
  40. // ensure to set the slug for "all" albums 
  41. $album->slug = ($albumID == 'all') ? $album->id : $album->slug; 
  42.  
  43. if ( is_array($album->gallery_ids) ) 
  44. $out = nggCreateAlbum( $album->gallery_ids, $template, $album ); 
  45.  
  46. $out = apply_filters( 'ngg_show_album_content', $out, $album->id ); 
  47.  
  48. return $out;