Advertisement
Uranbold

tw-gallery.php

Mar 6th, 2017
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. <?php
  2. $atts = shortcode_atts( array(
  3. 'css' => '',
  4. 'custom_class' => '',
  5. 'element_class' => 'tw-element tw-gallery',
  6. 'element_dark' => '',
  7. 'animation' => 'none',
  8. 'animation_delay' => '',
  9. /*--------------- */
  10. 'images' => '',
  11. 'type' => 'portfolio_m2',
  12. 'ppadding' => '30',
  13. ), vc_map_get_attributes($this->getShortcode(),$atts) );
  14. $class=apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, vc_shortcode_custom_css_class( $atts['css'], ' ' ), $this->settings['base'], $atts );
  15.  
  16.  
  17. $item_style = $start = $end = '';
  18. if($atts['type'] != 'slider'){
  19. $gallery_style = ' style="margin: 0 -'.$atts['ppadding'].'px -'.$atts['ppadding'].'px 0;"';
  20. $item_style = ' style="padding: 0 '.$atts['ppadding'].'px '.$atts['ppadding'].'px 0;"';
  21. if($atts['type']=='portfolio_m2' || $atts['type']=='portfolio_m3'){
  22. wp_enqueue_script('waves-isotope');
  23. $start = '<div class="gallery-isotope '.$atts['type'].'"'.$gallery_style.'>';
  24. $end = '</div>';
  25. }
  26. }
  27.  
  28. $output = waves_item($atts,$class);
  29. $images = explode(',',$atts['images']);
  30. $size = 'waves_'.($atts['type'] == 'slider' ? 'featured_img' : $atts['type']);
  31. $output .= $start;
  32. foreach($images as $image){
  33. $output .= '<div class="tw-gallery-item"'.$item_style.'>';
  34. $output .= '<a href="'.esc_url(waves_get_image_by_id($image,true,'full')).'" rel="prettyPhoto['.$atts['images'].']">';
  35. $output .= waves_get_image_by_id($image,false,$size);
  36. $output .= '<span class="image-overlay">'.wp_prepare_attachment_for_js($image)['caption'].'</span>';
  37. $output .= '</a>';
  38. $output .= '</div>';
  39. }
  40. $output .= $end;
  41. $output .= '</div>';
  42.  
  43. echo balanceTags($output);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement