Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function rb_getGalleryThumbs($postID=''){
- $re = '';
- if(is_single() || is_category() || is_tag() || is_archive() || is_search() || is_404())
- return '<ul id="bgImages" data-gallery-id="0"></ul>';
- global $wpdb;
- $fpgalleryid = get_option('defaultGallery');
- if(!empty($postID)){
- $pageGalleryID = get_post_meta($postID, "pageGalleryId", true);
- if(!(empty($pageGalleryID) || $pageGalleryID=='Default') )
- $fpgalleryid = $pageGalleryID;
- if($fpgalleryid=='NoGallery') $fpgalleryid = '';
- }
- if(empty($fpgalleryid)) $fpgalleryid = 0;
- $re .= '<ul id="bgImages" data-gallery-id="'.$fpgalleryid.'">'."\n";
- if(!empty($fpgalleryid))
- {
- $rb_gallery_post = get_post($fpgalleryid);
- if(isset($rb_gallery_post->post_content))
- {
- $rb_gallery_content = $rb_gallery_post->post_content;
- $rb_gallery_array = rb_sh2array($rb_gallery_content);
- if($rb_gallery_array[0]['shortcode']=='rb_gallery')
- {
- foreach($rb_gallery_array[0]['content'] as $item)
- {
- if($item['shortcode']=='rb_gallery_item'){
- $re .= "\t\t\t".'<li>'."\n";
- $attr =$item['attr'];
- if($attr['type']=='image')
- $re .= "\t\t\t\t".'<a href="'.$attr['url'].'" title="'.$attr['caption'].'">'."\n";
- elseif($attr['type']=='video'){
- $video_type = rb_getMediaType($attr['url']);
- $video_id = rb_getParamsFromUrl($attr['url']);
- if($video_type=='vimeo')
- $re .= "\t\t\t\t".'<a href="http://vimeo.com/'.$video_id['v'].'?width='.$attr['width'].'&height='.$attr['height'].'">'."\n";
- elseif($video_type=='youtube')
- $re .= "\t\t\t\t".'<a href="http://youtu.be/'.$video_id['v'].'?width='.$attr['width'].'&height='.$attr['height'].'">'."\n";
- else{
- $poster='';
- if(!empty($attr['thumbnail']))
- $poster = '&poster='.$attr['thumbnail'];
- $re .= "\t\t\t\t".'<a href="'.$attr['url'].'?width='.$attr['width'].'&height='.$attr['height'].$poster.'">'."\n";
- }
- }
- if(function_exists('wpthumb'))
- $re .= "\t\t\t\t\t".'<img src="'.wpthumb($attr['thumbnail'],'height=120&resize=true&crop=1&crop_from_position='.$attr['crop']).'" alt="'.$attr['caption'].'" />'."\n";
- else
- $re .= "\t\t\t\t\t".'<img src="'.$attr['thumbnail'].'" alt="'.$attr['caption'].'" />'."\n";
- $re .= "\t\t\t\t".'</a>'."\n";
- if(!empty($attr['caption']))
- $re .= "\t\t\t\t".'<h3>'.stripslashes($attr['caption']).'</h3>'."\n";
- if(!empty($item['content']))
- $re .= "\t\t\t\t".'<p>'.stripslashes($item['content']).'</p>'."\n";
- $re .= "\t\t\t"."</li>\n";
- }
- }
- }
- }
- }
- $re .= "\t\t".'</ul>';
- return $re;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement