Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2012
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.03 KB | None | 0 0
  1. //----Gallery Page Short Code-----------
  2. public static function Gallery($atts){
  3.  
  4. if (!function_exists('getfilters')){
  5. function getfilters($gal){
  6. $filters = array();
  7. foreach($gal as $item){
  8. $filters = array_merge($filters,wp_get_object_terms($item->pid, 'ngg_tag', 'fields=names'));
  9. }
  10. $filters = array_unique($filters);
  11. foreach($filters as $filter){
  12. $html .= '<li><a id="'.$filter.'"><span>'.$filter.'</span></a></li>';
  13. }
  14. return $html;
  15. }
  16. }
  17.  
  18. if (!function_exists('toHTML')){
  19. function toHTML($gal){
  20. global $nggdb;
  21. $html = '';
  22. $html .= ' <div class="smaller-title border">
  23. <h2 class="category-title">'.gettitle($gal).'</h2>
  24.  
  25. </div>';
  26. $html .= '<div class="gal-wrapper">
  27. <ul class="images-gallery" id="all">';
  28. $elid = 0;
  29. foreach($gal as $item){
  30. $elid++;
  31. $picture = nggdb::find_image($item->pid);
  32. $html .= '
  33. <li class="'.implode(' ', wp_get_object_terms($item->pid, 'ngg_tag', 'fields=names')).'" data-id="'.$elid.'">
  34. <div class="ic_container"><a title="'.stripslashes(nggGallery::i18n($item->alttext)).'" rel="group" href="'.$picture->imageURL.'"><img src="'.$picture->thumbURL.'" alt="Hello World" /></a>
  35. <div class="ic_caption">
  36. <h3>'.stripslashes(nggGallery::i18n($item->alttext)).'</h3>
  37. <p class="ic_text">'.$item->description.'</p>
  38. <p>'.nggcf_get_field($item->pid, 'YOUR CUSTOM FIELD NAME HERE').'</p>
  39. </div>
  40. </div></li>';
  41. }
  42.  
  43. $html .= ' </ul><div class="clear"></div>
  44. </div>';
  45. return $html;
  46. }
  47. }
  48. //----we have to check if there is a nextGenGalleryPlugin
  49. if (class_exists('nggLoader')){
  50. extract( shortcode_atts( array(
  51. 'id' => 0,
  52. ), $atts ) );
  53.  
  54. $gallery = getGallery($id);
  55. return toHTML($gallery);
  56. //if there is no nextGenGallery tell to get one
  57. }
  58. else {
  59. TiAdminPanel::AlertNow('error','NextGen Gallery plugin is not installed. I can not show you the gallery');
  60. }
  61. }
  62.  
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement