Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function print_carousel_slider($slider_xml, $size="940x360"){
- if( empty($slider_xml) ) return;
- global $gdl_element_id;
- echo '<div class="flexslider gdl-slider carousel-included" ';
- echo 'data-width="' . gdl_get_width($size) . '" >';
- echo '<ul class="slides">';
- foreach($slider_xml->childNodes as $slider){
- $title = find_xml_value($slider, 'title');
- $caption = html_entity_decode(find_xml_value($slider, 'caption'));
- $link = find_xml_value($slider, 'link');
- $link_type = find_xml_value($slider, 'linktype');
- $comment = find_xml_value($slider, 'comment');
- $image_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), $size);
- $alt_text = get_post_meta(find_xml_value($slider, 'image') , '_wp_attachment_image_alt', true);
- echo '<li>';
- if($link_type == 'Lightbox'){
- $image_full_url = wp_get_attachment_image_src(find_xml_value($slider, 'image'), 'full');
- echo '<a data-rel="fancybox" data-fancybox-group="gal' . $gdl_element_id . '" href="' . $image_full_url[0] . '" title="' . $alt_text . '">';
- }else if($link_type == 'Link to Video'){
- echo '<a data-rel="fancybox" data-fancybox-group="gal' . $gdl_element_id . '" href="' . $link . '" title="' . $alt_text . '">';
- }else if($link_type != 'No Link'){
- echo '<a href="' . $link . '" >';
- }
- echo '<img src="' . $image_url[0] . '" alt="' . $alt_text . '" />';
- if( !empty($title) || !empty($caption) ){
- echo '<div class="gdl-caption-overlay" ></div>';
- if( !empty($comment) ){
- echo '<div class="post-slider-comment" >';
- echo '<i class="icon-comments"></i>';
- echo $comment;
- echo '</div>';
- }
- echo '<div class="flex-caption">';
- echo '<div class="gdl-slider-caption-wrapper">';
- if( !empty($title) ){
- echo '<h2 class="gdl-slider-title">' . $title . '</h2>';
- }
- if( !empty($caption) ){
- echo '<div class="gdl-slider-caption">'. $caption . '</div>';
- }
- echo '</div>';
- echo '</div>';
- }
- if($link_type != 'No Link'){
- echo '</a>';
- }
- echo '</li>';
- }
- echo "</ul>";
- $gdl_element_id++;
- echo "</div>"; // flex slider
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement