| 1 |
<?php |
| 2 |
/** |
| 3 |
* The template for Element Listings Results. |
| 4 |
* This is the template that elementor element listings, list, grid |
| 5 |
* |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; // Exit if accessed directly. |
| 10 |
} |
| 11 |
|
| 12 |
|
| 13 |
?> |
| 14 |
<div class="wdk-element" id="wdk_el_<?php echo esc_html($id_element);?>"> |
| 15 |
<div class="wdk-listings-results |
| 16 |
<?php echo wmvc_show_data('styles_thmbn_des_type',$settings, '');?> view-<?php echo wmvc_show_data('layout_type',$settings, '');?> |
| 17 |
<?php if(wmvc_show_data('enable_separed_styles',$settings, '') == true):?> enable_separed_styles <?php endif;?> |
| 18 |
<?php if |
| 19 |
( |
| 20 |
wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_ajax_results') && |
| 21 |
isset($settings['is_ajax_enable']) && $settings['is_ajax_enable'] == 'yes' |
| 22 |
):?> |
| 23 |
ajax_results_enabled |
| 24 |
<?php endif;?> |
| 25 |
" |
| 26 |
data-el_id="<?php echo esc_attr($this->get_id());?>" |
| 27 |
data-el_type="<?php echo esc_attr($this->get_name());?>" |
| 28 |
<?php |
| 29 |
$post_id = get_the_ID(); |
| 30 |
$post_object_id = get_queried_object_id(); |
| 31 |
if($post_object_id) |
| 32 |
$post_id = $post_object_id; |
| 33 |
|
| 34 |
global $wdk_listing_page_id; |
| 35 |
if(!empty($wdk_listing_page_id)) |
| 36 |
$post_id = $wdk_listing_page_id; |
| 37 |
?> |
| 38 |
data-el_page_id="<?php echo esc_attr($post_id);?>" |
| 39 |
|
| 40 |
<?php if($settings['get_filters_enable'] == 'yes'):?> id="results" <?php endif;?>> |
| 41 |
<?php if($settings['get_filters_enable'] == 'yes' |
| 42 |
&& !( |
| 43 |
$settings['sorting_enable'] != 'yes' && |
| 44 |
$settings['view_type_enable'] != 'yes' && |
| 45 |
$settings['show_numbers_results_enable'] != 'yes' |
| 46 |
)):?> |
| 47 |
<div class="wdk-filter-head"> |
| 48 |
<?php if($settings['sorting_enable'] == 'yes'):?> |
| 49 |
<div class="filter-group order"> |
| 50 |
<?php \Elementor\Icons_Manager::render_icon( $settings['filter_group_box_icon'], [ 'aria-hidden' => 'true' ] );?> |
| 51 |
<select name="order_by" class='wdk-order'> |
| 52 |
<?php if(!empty($custom_order)):?> |
| 53 |
<?php foreach ($custom_order as $item):?> |
| 54 |
<option value="<?php echo wmvc_show_data('key', $item);?>" <?php echo (wmvc_show_data('order_by', $_GET, '') == wmvc_show_data('key', $item))?'selected="selected"':''; ?>><?php echo esc_html__(wmvc_show_data('title', $item), 'wpdirectorykit');?></option> |
| 55 |
<?php endforeach;?> |
| 56 |
<?php else:?> |
| 57 |
<option value="post_id DESC" <?php echo !empty(wmvc_show_data('order_by', $_GET, '') =='post_id DESC')?'selected="selected"':''; ?>><?php echo esc_html__('Sort by: Latest', 'wpdirectorykit');?></option> |
| 58 |
<option value="post_id ASC" <?php echo (wmvc_show_data('order_by', $_GET, '') =='post_id ASC')?'selected="selected"':''; ?>><?php echo esc_html__('Sort by: Oldest', 'wpdirectorykit');?></option> |
| 59 |
<option value="post_title ASC" <?php echo !empty(wmvc_show_data('order_by', $_GET, '') =='post_title ASC')?'selected="selected"':''; ?>><?php echo esc_html__('Sort by: Title Asc', 'wpdirectorykit');?></option> |
| 60 |
<option value="post_title DESC" <?php echo !empty(wmvc_show_data('order_by', $_GET, '') =='post_title DESC')?'selected="selected"':''; ?>><?php echo esc_html__('Sort by: Title Desc', 'wpdirectorykit');?></option> |
| 61 |
<?php endif;?> |
| 62 |
</select> |
| 63 |
</div> |
| 64 |
<?php endif;?> |
| 65 |
<?php if($settings['view_type_enable'] == 'yes'):?> |
| 66 |
<div class="filter-group wmvc-view-type"> |
| 67 |
<a class="nav-link <?php echo (wmvc_show_data('layout_type', $settings, '') =='list')?'active':''; ?>" data-id="list" href="#list-view"><i class="fa fa-list-ul"></i></a> |
| 68 |
<a class="nav-link <?php echo (wmvc_show_data('layout_type', $settings, '') =='grid')?'active':''; ?>" data-id="grid" href="#grid-view"><i class="fa fa-th"></i></a> |
| 69 |
</div> |
| 70 |
<?php endif;?> |
| 71 |
<?php if($settings['show_numbers_results_enable'] == 'yes'):?> |
| 72 |
<div class="filter-group filter-status"> |
| 73 |
<span><?php echo esc_html($listings_count);?> <?php echo esc_html__('Listings', 'wpdirectorykit');?></span> |
| 74 |
</div> |
| 75 |
<?php endif;?> |
| 76 |
</div> |
| 77 |
<?php endif;?> |
| 78 |
<?php if(!empty($results)):?> |
| 79 |
<?php if($settings['layout_type'] == 'carousel'):?> |
| 80 |
<div class="wdk_results_listings_slider_box <?php echo esc_attr($settings['layout_carousel_animation_style']).'_animation';?> <?php echo join(' ', [$settings['styles_carousel_dots_position_style'], $settings['styles_carousel_arrows_position']]);?>"> |
| 81 |
<div class="wdk_results_listings_slider_body"> |
| 82 |
<div class="wdk_results_listings_slider_ini"> |
| 83 |
<?php else:?> |
| 84 |
<div class="wdk-row wdk-inner-listings-results <?php if(isset($settings['is_mobile_view_enable']) && $settings['is_mobile_view_enable'] == 'yes'):?> WdkScrollMobileSwipe_enable <?php endif;?>"> |
| 85 |
<?php endif;?> |
| 86 |
<?php foreach($results as $listing):?> |
| 87 |
<div class="wdk-col"> |
| 88 |
<?php if |
| 89 |
( |
| 90 |
wdk_get_option('wdk_experimental_features') && wdk_get_option('wdk_experimental_listing_card_elementor_layout') && |
| 91 |
isset($settings['is_custom_layout_enable']) && $settings['is_custom_layout_enable'] == 'yes' |
| 92 |
&& isset($settings['custom_layout_id_list']) && isset($settings['custom_layout_id_grid']) |
| 93 |
):?> |
| 94 |
<?php if($settings['layout_type'] == 'list' && !empty($settings['custom_layout_id_list'])):?> |
| 95 |
<?php |
| 96 |
$content = ''; |
| 97 |
$post_data = get_post($settings['custom_layout_id_list']); |
| 98 |
|
| 99 |
global $wdk_listing_id; |
| 100 |
$wdk_listing_id = wmvc_show_data('post_id', $listing); |
| 101 |
if($post_data){ |
| 102 |
if($post_data->post_type == 'page' || $post_data->post_type == 'elementor_library') { |
| 103 |
$elementor_instance = \Elementor\Plugin::instance(); |
| 104 |
$content = $elementor_instance->frontend->get_builder_content_for_display($settings['custom_layout_id_list']); |
| 105 |
if(empty($content )) |
| 106 |
$content = $post_data->post_content; |
| 107 |
} else { |
| 108 |
$content = $post_data->post_content; |
| 109 |
} |
| 110 |
} |
| 111 |
?> |
| 112 |
<?php if(!$is_edit_mode):?> |
| 113 |
<?php echo wp_kses_post($content);?> |
| 114 |
<?php else:?> |
| 115 |
<?php echo esc_html__( 'Listings Card Grid From Extern Layout', 'wpdirectorykit' );?> |
| 116 |
<?php endif;?> |
| 117 |
<?php elseif($settings['layout_type'] == 'grid' && !empty($settings['custom_layout_id_grid'])):?> |
| 118 |
<?php |
| 119 |
$content = ''; |
| 120 |
$post_data = get_post($settings['custom_layout_id_grid']); |
| 121 |
|
| 122 |
global $wdk_listing_id; |
| 123 |
$wdk_listing_id = wmvc_show_data('post_id', $listing); |
| 124 |
if($post_data){ |
| 125 |
if($post_data->post_type == 'page' || $post_data->post_type == 'elementor_library') { |
| 126 |
$elementor_instance = \Elementor\Plugin::instance(); |
| 127 |
$content = $elementor_instance->frontend->get_builder_content_for_display($settings['custom_layout_id_grid']); |
| 128 |
if(empty($content )) |
| 129 |
$content = $post_data->post_content; |
| 130 |
} else { |
| 131 |
$content = $post_data->post_content; |
| 132 |
} |
| 133 |
} |
| 134 |
?> |
| 135 |
<?php if(!$is_edit_mode):?> |
| 136 |
<?php echo wp_kses_post($content);?> |
| 137 |
<?php else:?> |
| 138 |
<?php echo esc_html__( 'Listings Card List From Extern Layout', 'wpdirectorykit' );?> |
| 139 |
<?php endif;?> |
| 140 |
<?php else:?> |
| 141 |
<?php echo wdk_listing_card($listing, $settings);?> |
| 142 |
<?php endif;?> |
| 143 |
<?php else:?> |
| 144 |
<?php echo wdk_listing_card($listing, $settings);?> |
| 145 |
<?php endif;?> |
| 146 |
</div> |
| 147 |
<?php endforeach;?> |
| 148 |
<?php if($settings['layout_type'] == 'carousel'):?> |
| 149 |
</div> |
| 150 |
<div class="wdk_slider_arrows"> |
| 151 |
<a class="wdk-slider-prev wdk_lr_slider_arrow"> |
| 152 |
<?php \Elementor\Icons_Manager::render_icon( $settings['styles_carousel_arrows_icon_left'], [ 'aria-hidden' => 'true' ] ); ?> |
| 153 |
</a> |
| 154 |
<a class="wdk-slider-next wdk_lr_slider_arrow"> |
| 155 |
<?php \Elementor\Icons_Manager::render_icon( $settings['styles_carousel_arrows_icon_right'], [ 'aria-hidden' => 'true' ] ); ?> |
| 156 |
</a> |
| 157 |
</div> |
| 158 |
</div> |
| 159 |
</div> |
| 160 |
<?php else:?> |
| 161 |
</div> |
| 162 |
<?php endif;?> |
| 163 |
<?php else:?> |
| 164 |
<p class="wdk_alert wdk_alert-danger"><?php echo esc_html__('Results not found', 'wpdirectorykit');?></p> |
| 165 |
<?php endif;?> |
| 166 |
<?php if($settings['layout_type'] != 'carousel'):?> |
| 167 |
<?php echo wmvc_xss_clean($pagination_output); ?> |
| 168 |
<?php endif;?> |
| 169 |
</div> |
| 170 |
<?php if($settings['layout_type'] == 'carousel'):?> |
| 171 |
<script> |
| 172 |
jQuery(document).ready(function($){ |
| 173 |
var el = $('#wdk_el_<?php echo esc_html($id_element);?> .wdk_results_listings_slider_ini').slick({ |
| 174 |
dots: true, |
| 175 |
arrows: true, |
| 176 |
<?php if(!empty(wmvc_show_data('layout_carousel_is_centerMode', $settings))):?> |
| 177 |
centerMode: <?php echo wmvc_show_data('layout_carousel_is_centerMode', $settings, 'true');?>, |
| 178 |
<?php endif;?> |
| 179 |
slidesToShow: <?php echo (!empty(trim(wmvc_show_data('layout_carousel_columns', $settings, '3')))) ? wmvc_show_data('layout_carousel_columns', $settings, '3') : 3;?>, |
| 180 |
slidesToScroll: <?php echo (!empty(trim(wmvc_show_data('layout_carousel_columns', $settings, '3')))) ? wmvc_show_data('layout_carousel_columns', $settings, '3') : 3;?>, |
| 181 |
<?php if(!empty(wmvc_show_data('layout_carousel_is_infinite', $settings))):?> |
| 182 |
infinite: <?php echo wmvc_show_data('layout_carousel_is_infinite', $settings, 'true');?>, |
| 183 |
<?php endif;?> |
| 184 |
<?php if(!empty(wmvc_show_data('layout_carousel_is_autoplay', $settings))):?> |
| 185 |
autoplay: <?php echo wmvc_show_data('layout_carousel_is_autoplay', $settings, 'false');?>, |
| 186 |
<?php endif;?> |
| 187 |
nextArrow: $('#wdk_el_<?php echo esc_html($id_element);?> .wdk_slider_arrows .wdk-slider-next'), |
| 188 |
prevArrow: $('#wdk_el_<?php echo esc_html($id_element);?> .wdk_slider_arrows .wdk-slider-prev'), |
| 189 |
customPaging: function(slider, i) { |
| 190 |
// this example would render "tabs" with titles |
| 191 |
return '<span class="wdk_lr_dot"><?php \Elementor\Icons_Manager::render_icon( $settings['styles_carousel_dots_icon'], [ 'aria-hidden' => 'true' ] ); ?></span>'; |
| 192 |
}, |
| 193 |
responsive: [ |
| 194 |
{ |
| 195 |
breakpoint: 991, |
| 196 |
settings: { |
| 197 |
slidesToShow: <?php echo (!empty(trim(wmvc_show_data('layout_carousel_columns_tablet', $settings, '2')))) ? wmvc_show_data('layout_carousel_columns_tablet', $settings, '2') : 2;?>, |
| 198 |
slidesToScroll: <?php echo (!empty(trim(wmvc_show_data('layout_carousel_columns_tablet', $settings, '2')))) ? wmvc_show_data('layout_carousel_columns_tablet', $settings, '2') : 2;?>, |
| 199 |
} |
| 200 |
}, |
| 201 |
{ |
| 202 |
breakpoint: 768, |
| 203 |
settings: { |
| 204 |
slidesToShow: <?php echo (!empty(trim(wmvc_show_data('layout_carousel_columns_mobile', $settings, '1')))) ? wmvc_show_data('layout_carousel_columns_mobile', $settings, '1') : 1;?>, |
| 205 |
slidesToScroll: <?php echo (!empty(trim(wmvc_show_data('layout_carousel_columns_mobile', $settings, '1')))) ? wmvc_show_data('layout_carousel_columns_mobile', $settings, '1') : 1;?>, |
| 206 |
} |
| 207 |
}, |
| 208 |
] |
| 209 |
}).on('breakpoint', function(event, slick, breakpoint){ |
| 210 |
wdk_result_listings_thumbnail_slider(el); |
| 211 |
|
| 212 |
if (typeof wdk_favorite == 'function') { |
| 213 |
wdk_favorite('.wdk_results_listings_slider_ini'); |
| 214 |
} |
| 215 |
|
| 216 |
if (typeof wdk_init_compare_elem == 'function') { |
| 217 |
wdk_init_compare_elem(); |
| 218 |
} |
| 219 |
|
| 220 |
}); |
| 221 |
|
| 222 |
wdk_slick_slider_init(el, ()=>{ |
| 223 |
wdk_result_listings_thumbnail_slider(el); |
| 224 |
|
| 225 |
if (typeof wdk_favorite == 'function') { |
| 226 |
wdk_favorite('.wdk_results_listings_slider_ini'); |
| 227 |
} |
| 228 |
|
| 229 |
if (typeof wdk_init_compare_elem == 'function') { |
| 230 |
wdk_init_compare_elem(); |
| 231 |
} |
| 232 |
}); |
| 233 |
}) |
| 234 |
</script> |
| 235 |
<?php endif;?> |
| 236 |
<?php if($is_edit_mode):?> |
| 237 |
<script> |
| 238 |
jQuery(document).ready(function($){ |
| 239 |
if(typeof wdk_result_listings_thumbnail_slider == 'function') { |
| 240 |
wdk_result_listings_thumbnail_slider(); |
| 241 |
} |
| 242 |
}) |
| 243 |
</script> |
| 244 |
<?php endif;?> |
| 245 |
</div> |
| 246 |
|
| 247 |
|