Guest User

Untitled

a guest
Aug 22nd, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.81 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. class td_smart_list_mob_1 extends td_smart_list {
  5.  
  6. protected function render_before_list_wrap() {
  7. if(td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
  8. $td_class_nr_of_columns = ' td-3-columns ';
  9. } else {
  10. $td_class_nr_of_columns = ' td-2-columns ';
  11. }
  12.  
  13. $buffy = '';
  14.  
  15. //wrapper with id for smart list wrapper type 2
  16. $buffy .= '<div class="td_smart_list_2' . $td_class_nr_of_columns . '">';
  17.  
  18. return $buffy;
  19. }
  20.  
  21.  
  22. protected function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number) {
  23. //print_r($item_array);
  24. $buffy = '';
  25.  
  26. //get the title
  27. $smart_list_2_title = '';
  28. if(!empty($item_array['title'])) {
  29. $smart_list_2_title = $item_array['title'];
  30. }
  31.  
  32. //creating each slide
  33. $buffy .= '<div class="td-item">';
  34. $buffy .= '<div class="td-number-and-title"><h2><span class="td-sml-current-item-nr">' . $current_item_number. '</span><span class="td-sml-current-item-title">' . $smart_list_2_title . '</span></h2></div>';
  35.  
  36. //get image info
  37. $first_img_all_info = td_util::attachment_get_full_info($item_array['first_img_id']);
  38.  
  39. //get image link target
  40. $first_img_link_target = $item_array['first_img_link_target'];
  41.  
  42. //image caption
  43. $first_img_caption = $item_array['first_img_caption'];
  44.  
  45. //image type and width - used to retrieve retina image
  46. $image_type = 'td_696x0';
  47. $image_width = '696';
  48.  
  49. if(td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
  50. $first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_1068x0');
  51. //change image type and width - used to retrieve retina image
  52. $image_type = 'td_1068x0';
  53. $image_width = '1068';
  54. } else {
  55. $first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_696x0');
  56. }
  57. if (!empty($first_img_info[0])) {
  58.  
  59. //retina image
  60. $srcset_sizes = td_util::get_srcset_sizes($item_array['first_img_id'], $image_type, $image_width, $first_img_info[0]);
  61.  
  62. // class used by magnific popup
  63. $smart_list_lightbox = " td-lightbox-enabled";
  64.  
  65. // if a custom link is set use it
  66. if (!empty($item_array['first_img_link']) && $first_img_all_info['src'] != $item_array['first_img_link']) {
  67. $first_img_all_info['src'] = $item_array['first_img_link'];
  68.  
  69. // remove the magnific popup class for custom links
  70. $smart_list_lightbox = "";
  71. }
  72.  
  73. $buffy .= '
  74. <figure class="td-slide-smart-list-figure td-slide-smart-list-2' . $smart_list_lightbox . '">
  75. <a class="td-sml-link-to-image" href="' . $first_img_all_info['src'] . '" data-caption="' . esc_attr($first_img_caption, ENT_QUOTES) . '" ' . $first_img_link_target .' >
  76. <img src="' . $first_img_info[0] . '"' . $srcset_sizes . '/>
  77. </a>
  78. </figure>
  79. <figcaption class="td-sml-caption"><div>' . $first_img_caption . '</div></figcaption>
  80. ';
  81. }
  82.  
  83. //adding description
  84. if(!empty($item_array['description'])) {
  85. $buffy .= '<span class="td-sml-description">' . $item_array['description'] . '</span>';
  86. }
  87.  
  88. $buffy .= '</div>';
  89.  
  90. return $buffy;
  91. }
  92.  
  93.  
  94. protected function render_after_list_wrap() {
  95. $buffy = '';
  96. $buffy .= '</div>'; // /.td_smart_list_2 wrapper with id
  97.  
  98. return $buffy;
  99. }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment