Guest User

Untitled

a guest
Sep 16th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.10 KB | None | 0 0
  1. <?php
  2.  
  3.  
  4. class td_smart_list_7 extends td_smart_list {
  5.  
  6. protected $use_pagination = true; // set this to true to use rela pagination on this template
  7.  
  8.  
  9. protected function render_before_list_wrap() {
  10. if(td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
  11. $td_class_nr_of_columns = ' td-3-columns ';
  12. } else {
  13. $td_class_nr_of_columns = ' td-2-columns ';
  14. }
  15.  
  16. $buffy = '';
  17.  
  18. //wrapper with id for smart list wrapper type 7
  19. $buffy .= '<div class="td_smart_list_7' . $td_class_nr_of_columns . '">';
  20.  
  21. return $buffy;
  22. }
  23.  
  24.  
  25. protected function render_list_item($item_array, $current_item_id, $current_item_number, $total_items_number) {
  26. //print_r($item_array);
  27. $buffy = '';
  28.  
  29. // render the pagination
  30. $buffy .= $this->callback_render_pagination();
  31.  
  32. //creating each slide
  33. $buffy .= '<div class="td-item">';
  34. $buffy .= '<h2><span class="td-sml-current-item-title">' . $current_item_number. '. ' . $item_array['title'] . '</span></h2>';
  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.  
  43. //image caption
  44. $first_img_caption = $item_array['first_img_caption'];
  45.  
  46. //image type and width - used to retrieve retina image
  47. $image_type = 'td_696x0';
  48. $image_width = '696';
  49.  
  50. if(td_global::$cur_single_template_sidebar_pos == 'no_sidebar') {
  51. $first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_1068x0');
  52. //change image type and width - used to retrieve retina image
  53. $image_type = 'td_1068x0';
  54. $image_width = '1068';
  55. } else {
  56. $first_img_info = wp_get_attachment_image_src($item_array['first_img_id'], 'td_696x0');
  57. }
  58. if (!empty($first_img_info[0])) {
  59.  
  60. //retina image
  61. $srcset_sizes = td_util::get_srcset_sizes($item_array['first_img_id'], $image_type, $image_width, $first_img_info[0]);
  62.  
  63. // class used by magnific popup
  64. $smart_list_lightbox = " td-lightbox-enabled";
  65.  
  66. // if a custom link is set use it
  67. if (!empty($item_array['first_img_link']) && $first_img_all_info['src'] != $item_array['first_img_link']) {
  68. $first_img_all_info['src'] = $item_array['first_img_link'];
  69.  
  70. // remove the magnific popup class for custom links
  71. $smart_list_lightbox = "";
  72. }
  73.  
  74. $buffy .= '
  75. <figure class="td-slide-smart-list-figure td-slide-smart-list-7' . $smart_list_lightbox . '">
  76. <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 . ' >
  77. <img src="' . $first_img_info[0] . '"' . $srcset_sizes . '/>
  78. </a>
  79. <figcaption class="td-sml-caption"><div>' . $first_img_caption . '</div></figcaption>
  80. </figure>';
  81. }
  82.  
  83.  
  84. //adding description
  85. if(!empty($item_array['description'])) {
  86. $buffy .= '<span class="td-sml-description">' . $item_array['description'] . '</span>';
  87. }
  88.  
  89. $tds_smart_list_7_title = td_util::get_option('tds_smart_list_7_title');
  90.  
  91. // ad smart list 7
  92. $buffy .= td_global_blocks::get_instance('td_block_ad_box')->render(array('spot_id' => 'smart_list_7', 'spot_title' => $tds_smart_list_7_title));
  93.  
  94.  
  95.  
  96. // render the pagination
  97. $buffy .= $this->callback_render_pagination();
  98.  
  99. $buffy .= '</div>';
  100.  
  101. return $buffy;
  102. }
  103.  
  104.  
  105.  
  106. protected function render_after_list_wrap() {
  107. $buffy = '';
  108. $buffy .= '</div>'; // /.td_smart_list_7 wrapper with id
  109.  
  110. return $buffy;
  111. }
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118. }
Advertisement
Add Comment
Please, Sign In to add comment