Advertisement
Guest User

Untitled

a guest
Oct 6th, 2015
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.18 KB | None | 0 0
  1.     function print_carousel_slider($slider_xml, $size="940x360"){
  2.         if( empty($slider_xml) ) return;
  3.        
  4.         global $gdl_element_id;
  5.        
  6.         echo '<div class="flexslider gdl-slider carousel-included" ';
  7.         echo 'data-width="' . gdl_get_width($size) . '" >';
  8.         echo '<ul class="slides">';
  9.         foreach($slider_xml->childNodes as $slider){
  10.        
  11.             $title = find_xml_value($slider, 'title');
  12.             $caption = html_entity_decode(find_xml_value($slider, 'caption'));
  13.             $link = find_xml_value($slider, 'link');
  14.             $link_type = find_xml_value($slider, 'linktype');          
  15.             $comment = find_xml_value($slider, 'comment');         
  16.             $image_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), $size);
  17.             $alt_text = get_post_meta(find_xml_value($slider, 'image') , '_wp_attachment_image_alt', true);
  18.            
  19.             echo '<li>';
  20.             if($link_type == 'Lightbox'){
  21.                 $image_full_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), 'full');
  22.                 echo '<a data-rel="fancybox" data-fancybox-group="gal' . $gdl_element_id . '" href="' . $image_full_url[0] . '"  title="' . $alt_text . '">';  
  23.             }else if($link_type == 'Link to Video'){
  24.                 echo '<a data-rel="fancybox" data-fancybox-group="gal' . $gdl_element_id . '" href="' . $link . '"  title="' . $alt_text . '">';   
  25.             }else if($link_type != 'No Link'){
  26.                 echo '<a href="' . $link . '" >';
  27.             }
  28.                
  29.             echo '<img src="' . $image_url[0] . '" alt="' . $alt_text . '" />';
  30.             if( !empty($title) || !empty($caption) ){
  31.                 echo '<div class="gdl-caption-overlay" ></div>';
  32.                 if( !empty($comment) ){
  33.                     echo '<div class="post-slider-comment" >';
  34.                     echo '<i class="icon-comments"></i>';
  35.                     echo $comment;
  36.                     echo '</div>';
  37.                 }              
  38.                
  39.                 echo '<div class="flex-caption">';
  40.                 echo '<div class="gdl-slider-caption-wrapper">';
  41.                 if( !empty($title) ){
  42.                     echo '<h2 class="gdl-slider-title">' . $title . '</h2>';
  43.                 }
  44.                 if( !empty($caption) ){
  45.                     echo '<div class="gdl-slider-caption">'. $caption . '</div>';
  46.                 }
  47.                 echo '</div>';
  48.                 echo '</div>';
  49.             }
  50.            
  51.             if($link_type != 'No Link'){
  52.                 echo '</a>';
  53.             }
  54.             echo '</li>';
  55.            
  56.         }
  57.         echo "</ul>";
  58.        
  59.         $gdl_element_id++;
  60.         echo "</div>"; // flex slider
  61.  
  62.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement