PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.9.21
Shortcodes and extra features for Phlox theme v2.9.21
2.17.21 2.17.20 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.6 1.0.9 1.1.0 1.3.0 1.3.1 1.3.10 1.3.14 1.3.2 1.3.3 1.3.6 1.4.0 1.4.1 1.4.2 1.5.0 1.5.2 1.6.0 1.6.2 1.6.4 1.7.0 1.7.2 2.10.0 2.10.1 2.10.3 2.10.5 2.10.7 2.10.8 2.10.9 2.11.0 2.11.1 2.11.2 2.12.0 2.14.0 2.15.0 2.15.2 2.15.4 2.15.5 2.15.6 2.15.7 2.15.8 2.15.9 2.16.0 2.16.1 2.16.2 2.16.3 2.16.4 2.17.0 2.17.1 2.17.12 2.17.13 2.17.14 2.17.15 2.17.16 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.8 2.17.9 2.4.12 2.4.13 2.4.14 2.4.16 2.4.18 2.4.19 2.4.9 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.14 2.5.15 2.5.16 2.5.17 2.5.19 2.5.2 2.5.20 2.5.3 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.10 2.6.12 2.6.13 2.6.14 2.6.15 2.6.16 2.6.17 2.6.19 2.6.2 2.6.20 2.6.4 2.6.5 2.6.7 2.7.0 2.7.1 2.7.10 2.7.11 2.7.12 2.7.13 2.7.14 2.7.2 2.7.3 2.7.4 2.7.5 2.7.6 2.7.7 2.7.8 2.7.9 2.8.0 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.9 2.9.0 2.9.12 2.9.14 2.9.15 2.9.16 2.9.17 2.9.18 2.9.19 2.9.2 2.9.20 2.9.21 2.9.22 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8
auxin-elements / includes / elements / recent-products.php
auxin-elements / includes / elements Last commit date
about-widget.php 4 years ago accordion-widget.php 4 years ago accordion.php 4 years ago attachment-url.php 4 years ago audio.php 4 years ago before-after.php 4 years ago button.php 4 years ago code.php 4 years ago contact-box.php 4 years ago contact-form.php 4 years ago custom-list.php 4 years ago divider.php 4 years ago dropcap.php 4 years ago facebook.php 4 years ago flickr.php 4 years ago gallery.php 4 years ago general-element-fields.php 4 years ago gmap.php 4 years ago highlight.php 4 years ago image.php 4 years ago instagram-feed.php 4 years ago latest-items.php 4 years ago latest-posts-slider.php 4 years ago popular-posts-widget.php 4 years ago products-grid.php 4 years ago quote.php 4 years ago recent-posts-grid-carousel.php 3 years ago recent-posts-land-style.php 4 years ago recent-posts-masonry.php 4 years ago recent-posts-tiles-carousel.php 3 years ago recent-posts-tiles.php 4 years ago recent-posts-timeline.php 4 years ago recent-posts-widget.php 4 years ago recent-products.php 3 years ago related-posts.php 8 years ago sample-element.php 4 years ago search.php 4 years ago socials-list.php 4 years ago staff.php 4 years ago tab-widget.php 4 years ago tabs.php 4 years ago testimonial.php 4 years ago text.php 3 years ago touch-slider.php 4 years ago video.php 4 years ago
recent-products.php
637 lines
1 <?php
2 /**
3 * Woocommerce Recent Products Element
4 *
5 *
6 * @package Auxin
7 * @license LICENSE.txt
8 * @author averta
9 * @link http://phlox.pro/
10 * @copyright (c) 2010-2022 averta
11 */
12 function auxin_get_the_recent_products_master_array( $master_array ) {
13
14 $master_array['aux_recent_product'] = array(
15 'name' => __("Recent Products", 'auxin-elements' ),
16 'auxin_output_callback' => 'auxin_widget_the_recent_products_callback',
17 'base' => 'aux_recent_product',
18 'description' => __("a Widget for Display Your Store's Products", 'auxin-elements' ),
19 'class' => 'aux-widget-recent-products',
20 'show_settings_on_create' => true,
21 'weight' => 1,
22 'category' => THEME_NAME,
23 'is_vc' => true,
24 'is_widget' => true,
25 'is_shortcode' => true,
26 'group' => '',
27 'admin_enqueue_js' => '',
28 'admin_enqueue_css' => '',
29 'front_enqueue_js' => '',
30 'front_enqueue_css' => '',
31 'icon' => 'aux-element aux-pb-icons-grid',
32 'custom_markup' => '',
33 'js_view' => '',
34 'html_template' => '',
35 'deprecated' => '',
36 'content_element' => '',
37 'as_parent' => '',
38 'as_child' => '',
39 'params' => array(
40 array(
41 'heading' => __('Title','auxin-elements' ),
42 'description' => __('Recent products title, leave it empty if you don`t need title.', 'auxin-elements'),
43 'param_name' => 'title',
44 'type' => 'textfield',
45 'value' => '',
46 'holder' => 'textfield',
47 'class' => 'title',
48 'admin_label' => false,
49 'dependency' => '',
50 'weight' => '',
51 'group' => '',
52 'edit_field_class' => ''
53 ),
54 array(
55 'heading' => __('Subtitle','auxin-elements' ),
56 'description' => __('Recent products subtitle, leave it empty if you don`t need title.', 'auxin-elements'),
57 'param_name' => 'subtitle',
58 'type' => 'textfield',
59 'value' => '',
60 'holder' => 'textfield',
61 'class' => 'title',
62 'admin_label' => false,
63 'dependency' => '',
64 'weight' => '',
65 'group' => '',
66 'edit_field_class' => ''
67 ),
68 array(
69 'heading' => __('Categories', 'auxin-elements'),
70 'description' => __('Specifies a category that you want to show posts from it.', 'auxin-elements' ),
71 'param_name' => 'cat',
72 'type' => 'aux_taxonomy',
73 'taxonomy' => 'product_cat',
74 'def_value' => ' ',
75 'holder' => '',
76 'class' => 'cat',
77 'value' => ' ', // should use the taxonomy name
78 'admin_label' => false,
79 'dependency' => '',
80 'weight' => '',
81 'group' => 'Query',
82 'edit_field_class' => ''
83 ),
84 array(
85 'heading' => __('Image aspect ratio', 'auxin-elements'),
86 'description' => '',
87 'param_name' => 'image_aspect_ratio',
88 'type' => 'dropdown',
89 'def_value' => '0.75',
90 'holder' => '',
91 'class' => 'order',
92 'value' =>array (
93 '0.75' => __('Horizontal 4:3' , 'auxin-elements'),
94 '0.56' => __('Horizontal 16:9', 'auxin-elements'),
95 '1.00' => __('Square 1:1' , 'auxin-elements'),
96 '1.33' => __('Vertical 3:4' , 'auxin-elements'),
97 '1.5' => __('Vertical 10:15' , 'auxin-elements'),
98
99 ),
100 'admin_label' => false,
101 'dependency' => '',
102 'weight' => '',
103 'group' => '',
104 'edit_field_class' => ''
105 ),
106 array(
107 'heading' => __('Exclude posts without media','auxin-elements' ),
108 'description' => '',
109 'param_name' => 'exclude_without_media',
110 'type' => 'aux_switch',
111 'value' => '0',
112 'class' => '',
113 'admin_label' => false,
114 'dependency' => '',
115 'weight' => '',
116 'group' => 'Query',
117 'edit_field_class' => ''
118 ),
119 array(
120 'heading' => __('Order by', 'auxin-elements'),
121 'description' => '',
122 'param_name' => 'order_by',
123 'type' => 'dropdown',
124 'def_value' => 'date',
125 'holder' => '',
126 'class' => 'order_by',
127 'value' => array (
128 'date' => __('Date', 'auxin-elements'),
129 'menu_order date' => __('Menu Order', 'auxin-elements'),
130 'title' => __('Title', 'auxin-elements'),
131 'ID' => __('ID', 'auxin-elements'),
132 'rand' => __('Random', 'auxin-elements'),
133 'comment_count' => __('Comments', 'auxin-elements'),
134 'modified' => __('Date Modified', 'auxin-elements'),
135 'author' => __('Author', 'auxin-elements'),
136 'post__in' => __('Inserted Post IDs', 'auxin-elements')
137 ),
138 'admin_label' => false,
139 'dependency' => '',
140 'weight' => '',
141 'group' => 'Query',
142 'edit_field_class' => ''
143 ),
144 array(
145 'heading' => __('Order', 'auxin-elements'),
146 'description' => '',
147 'param_name' => 'order',
148 'type' => 'dropdown',
149 'def_value' => 'DESC',
150 'holder' => '',
151 'class' => 'order',
152 'value' =>array (
153 'DESC' => __('Descending', 'auxin-elements'),
154 'ASC' => __('Ascending', 'auxin-elements'),
155 ),
156 'admin_label' => false,
157 'dependency' => '',
158 'weight' => '',
159 'group' => 'Query',
160 'edit_field_class' => ''
161 ),
162 array(
163 'heading' => __('Only products','auxin-elements' ),
164 'description' => __('If you intend to display ONLY specific products, you should specify the products here. You have to insert the Products IDs that are separated by comma (eg. 53,34,87,25).', 'auxin-elements' ),
165 'param_name' => 'only_products__in',
166 'type' => 'textfield',
167 'value' => '',
168 'holder' => '',
169 'class' => '',
170 'admin_label' => false,
171 'dependency' => '',
172 'weight' => '',
173 'group' => 'Query',
174 'edit_field_class' => ''
175 ),
176 array(
177 'heading' => __('Include products','auxin-elements' ),
178 'description' => __('If you intend to include additional products, you should specify the products here. You have to insert the Products IDs that are separated by comma (eg. 53,34,87,25)', 'auxin-elements' ),
179 'param_name' => 'include',
180 'type' => 'textfield',
181 'value' => '',
182 'holder' => '',
183 'class' => '',
184 'admin_label' => false,
185 'dependency' => '',
186 'weight' => '',
187 'group' => 'Query',
188 'edit_field_class' => ''
189 ),
190 array(
191 'heading' => __('Exclude products','auxin-elements' ),
192 'description' => __('If you intend to exclude specific products from result, you should specify the products here. You have to insert the Products IDs that are separated by comma (eg. 53,34,87,25)', 'auxin-elements' ),
193 'param_name' => 'exclude',
194 'type' => 'textfield',
195 'value' => '',
196 'holder' => '',
197 'class' => '',
198 'admin_label' => false,
199 'dependency' => '',
200 'weight' => '',
201 'group' => 'Query',
202 'edit_field_class' => ''
203 ),
204 array(
205 'heading' => __('Start offset','auxin-elements' ),
206 'description' => __('Number of products to displace or pass over.', 'auxin-elements' ),
207 'param_name' => 'offset',
208 'type' => 'textfield',
209 'value' => '',
210 'holder' => '',
211 'class' => '',
212 'admin_label' => false,
213 'dependency' => '',
214 'weight' => '',
215 'group' => 'Query',
216 'edit_field_class' => ''
217 ),
218 array(
219 'heading' => __('Display products price', 'auxin-elements' ),
220 'param_name' => 'display_price',
221 'type' => 'aux_switch',
222 'def_value' => '',
223 'value' => '1',
224 'holder' => '',
225 'class' => 'display_price',
226 'admin_label' => false,
227 'dependency' => '',
228 'weight' => '',
229 'group' => '',
230 'edit_field_class' => ''
231 ),
232 array(
233 'heading' => __('Display sale badge', 'auxin-elements' ),
234 'param_name' => 'display_sale_badge',
235 'type' => 'aux_switch',
236 'def_value' => '',
237 'value' => '1',
238 'holder' => '',
239 'class' => 'display_sale_badge',
240 'admin_label' => false,
241 'dependency' => '',
242 'weight' => '',
243 'group' => '',
244 'edit_field_class' => ''
245 ),
246 array(
247 'heading' => __('Display product title','auxin-elements' ),
248 'description' => '',
249 'param_name' => 'display_title',
250 'type' => 'aux_switch',
251 'value' => '1',
252 'class' => 'display_title',
253 'admin_label' => false,
254 'dependency' => '',
255 'weight' => '',
256 'group' => '',
257 'edit_field_class' => ''
258 ),
259 array(
260 'heading' => __('Display Categories','auxin-elements' ),
261 'description' => '',
262 'param_name' => 'display_categories',
263 'type' => 'aux_switch',
264 'value' => '1',
265 'holder' => '',
266 'class' => 'display_categories',
267 'admin_label' => false,
268 'weight' => '',
269 'group' => '',
270 'edit_field_class' => ''
271 ),
272 array(
273 'heading' => __('Number of columns', 'auxin-elements'),
274 'description' => '',
275 'param_name' => 'desktop_cnum',
276 'type' => 'dropdown',
277 'def_value' => '4',
278 'holder' => '',
279 'class' => 'num',
280 'value' => array(
281 '1' => '1', '2' => '2', '3' => '3',
282 '4' => '4', '5' => '5', '6' => '6'
283 ),
284 'admin_label' => false,
285 'dependency' => '',
286 'weight' => '',
287 'group' => 'Layout',
288 'edit_field_class' => ''
289 ),
290 array(
291 'heading' => __('Number of columns in tablet size', 'auxin-elements'),
292 'description' => '',
293 'param_name' => 'tablet_cnum',
294 'type' => 'dropdown',
295 'def_value' => 'inherit',
296 'holder' => '',
297 'class' => 'num',
298 'value' => array(
299 'inherit' => 'Inherited from larger',
300 '1' => '1', '2' => '2', '3' => '3',
301 '4' => '4', '5' => '5', '6' => '6'
302 ),
303 'admin_label' => false,
304 'dependency' => '',
305 'weight' => '',
306 'group' => 'Layout',
307 'edit_field_class' => ''
308 ),
309 array(
310 'heading' => __('Number of columns in phone size', 'auxin-elements'),
311 'description' => '',
312 'param_name' => 'phone_cnum',
313 'type' => 'dropdown',
314 'def_value' => '1',
315 'holder' => '',
316 'class' => 'num',
317 'value' => array(
318 '1' => '1', '2' => '2', '3' => '3'
319 ),
320 'admin_label' => false,
321 'dependency' => '',
322 'weight' => '',
323 'group' => 'Layout',
324 'edit_field_class' => ''
325 ),
326 // array(
327 // 'heading' => __('Content layout', 'auxin-elements'),
328 // 'description' => __('Specifies the style of content for each post column.', 'auxin-elements' ),
329 // 'param_name' => 'content_layout',
330 // 'type' => 'dropdown',
331 // 'def_value' => 'default',
332 // 'holder' => '',
333 // 'class' => 'content_layout',
334 // 'value' =>array (
335 // 'default' => __('Full Content', 'auxin-elements'),
336 // 'entry-boxed' => __('Boxed Content', 'auxin-elements')
337 // ),
338 // 'admin_label' => false,
339 // 'dependency' => '',
340 // 'weight' => '',
341 // 'group' => '',
342 // 'edit_field_class' => ''
343 // ),
344 array(
345 'heading' => __('Extra class name','auxin-elements' ),
346 'description' => __('If you wish to style particular content element differently, then use this field to add a class name and then refer to it in your css file.', 'auxin-elements' ),
347 'param_name' => 'extra_classes',
348 'type' => 'textfield',
349 'value' => '',
350 'def_value' => '',
351 'holder' => '',
352 'class' => 'extra_classes',
353 'admin_label' => false,
354 'dependency' => '',
355 'weight' => '',
356 'group' => '',
357 'edit_field_class' => ''
358 )
359 )
360 );
361
362 return $master_array;
363 }
364
365 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_the_recent_products_master_array', 10, 1 );
366
367 function auxin_widget_the_recent_products_callback( $atts, $shortcode_content = null ){
368
369 // Defining default attributes
370 $default_atts = array(
371 'title' => '', // header title (required)
372 'subtitle' => '', // header subtitle
373 'cat' => ' ',
374 'num' => '8', // max generated entry
375 'only_products__in' => '', // display only these post IDs. array or string comma separated
376 'include' => '', // include these post IDs in result too. array or string comma separated
377 'exclude' => '', // exclude these post IDs from result. array or string comma separated
378 'offset' => '',
379 'paged' => 1,
380 'post_type' => 'product',
381 'taxonomy_name' => 'product_cat', // the taxonomy that we intent to display in post info
382 'tax_args' => '',
383 'order_by' => 'date',
384 'order' => 'DESC',
385 'exclude_without_media' => 0,
386 'display_title' => true,
387 'show_media' => true,
388 'display_categories' => true,
389 'display_button' => true,
390 'preloadable' => false,
391 'preload_preview' => true,
392 'preload_bgcolor' => '',
393 // 'content_layout' => '', // entry-boxed
394 'image_aspect_ratio' => 0.75,
395 'desktop_cnum' => 4,
396 'tablet_cnum' => 'inherit',
397 'phone_cnum' => '1',
398 'display_price' => true,
399 'display_sale_badge' => true,
400 'extra_classes' => '',
401 'template_part_file' => 'recent-products',
402 'extra_template_path' => AUXELS_PUB_DIR . '/templates/woocommerce',
403 'universal_id' => '',
404 'use_wp_query' => false, // true to use the global wp_query, false to use internal custom query
405 'reset_query' => true,
406 'wp_query_args' => array(), // additional wp_query args
407 'custom_wp_query' => '',
408 'base' => 'aux_recent_products',
409 'base_class' => 'aux-widget-recent-products',
410 'show_pagination' => ''
411 );
412
413 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
414 extract( $result['parsed_atts'] );
415
416 // get content width
417 global $aux_content_width;
418
419 ob_start();
420
421 if( empty( $cat ) || $cat == " " || ( is_array( $cat ) && in_array( " ", $cat ) ) ) {
422 $tax_args = array();
423 } else {
424 $tax_args = array(
425 array(
426 'taxonomy' => $taxonomy_name,
427 'field' => 'term_id',
428 'terms' => ! is_array( $cat ) ? explode( ",", $cat ) : $cat
429 )
430 );
431 }
432
433 if( $custom_wp_query ){
434 $wp_query = $custom_wp_query;
435
436 } elseif( ! $use_wp_query ){
437
438 // create wp_query to get latest items ---------------------------------
439 $args = array(
440 'post_type' => $post_type,
441 'orderby' => $order_by,
442 'order' => $order,
443 'offset' => $offset,
444 'paged' => $paged,
445 'tax_query' => $tax_args,
446 'post_status' => 'publish',
447 'posts_per_page' => $num,
448 'ignore_sticky_posts' => 1,
449
450 'include_posts__in' => $include, // include posts in this list
451 'posts__not_in' => $exclude, // exclude posts in this list
452 'posts__in' => $only_products__in, // only posts in this list
453
454 'exclude_without_media' => $exclude_without_media,
455 );
456
457 // ---------------------------------------------------------------------
458
459 // add the additional query args if available
460 if( $wp_query_args ){
461 $args = wp_parse_args( $wp_query_args, $args );
462 }
463
464 // pass the args through the auxin query parser
465 $wp_query = new WP_Query( auxin_parse_query_args( $args ) );
466 } else {
467
468 global $wp_query;
469 }
470
471 // widget header ------------------------------
472 echo wp_kses_post( $result['widget_header'] );
473 echo wp_kses_post( $result['widget_title'] );
474 echo '<h4 class="aux-h4 widget-subtitle">' . esc_html( $subtitle ) . '</h4>';
475
476 $phone_break_point = 767;
477 $tablet_break_point = 1025;
478
479 $show_comments = true; // shows comments icon
480 $post_counter = 0;
481 $column_class = '';
482 $item_class = '';
483
484 $columns_custom_styles = '';
485
486 if( ! empty( $loadmore_type ) ) {
487 $item_class .= ' aux-ajax-item';
488 }
489
490 $column_class .= '';
491 $item_class .= ' aux-recent-product-item aux-col';
492
493 // Specifies whether the columns have footer meta or not
494 $column_class .= ' aux-recent-products-wrapper aux-row aux-ajax-view aux-de-col' . $desktop_cnum;
495
496 $tablet_cnum = ('inherit' == $tablet_cnum ) ? $desktop_cnum : $tablet_cnum ;
497 $column_class .= ' aux-tb-col'.$tablet_cnum . ' aux-mb-col'.$phone_cnum;
498
499
500 // automatically calculate the media size if was empty
501 if( empty( $size ) ){
502 $column_media_width = auxin_get_content_column_width( $desktop_cnum, 15, $content_width );
503 $size = array( 'width' => $column_media_width, 'height' => $column_media_width * $image_aspect_ratio );
504 }
505
506 if ( !empty( $show_pagination ) ) {
507 $requiredData = array(
508 'display_price' => $result['parsed_atts']['display_price'],
509 'display_sale_badge' => $result['parsed_atts']['display_sale_badge'],
510 'show_media' => $result['parsed_atts']['show_media'],
511 'preloadable' => $result['parsed_atts']['preloadable'],
512 'preload_preview' => $result['parsed_atts']['preload_preview'],
513 'preload_bgcolor' => $result['parsed_atts']['preload_bgcolor'],
514 'display_title' => $result['parsed_atts']['display_title'],
515 'display_categories' => $result['parsed_atts']['display_categories'],
516 'display_button' => $result['parsed_atts']['display_button'],
517 'desktop_cnum' => $result['parsed_atts']['desktop_cnum'],
518 'tablet_cnum' => $result['parsed_atts']['tablet_cnum'],
519 'phone_cnum' => $result['parsed_atts']['phone_cnum'],
520 'cat' => $result['parsed_atts']['cat'],
521 'num' => $result['parsed_atts']['num'],
522 'exclude_without_media' => $result['parsed_atts']['exclude_without_media'],
523 'order_by' => $result['parsed_atts']['order_by'],
524 'order' => $result['parsed_atts']['order'],
525 'only_products__in' => $result['parsed_atts']['only_products__in'],
526 'include' => $result['parsed_atts']['include'],
527 'exclude' => $result['parsed_atts']['exclude'],
528 'offset' => $result['parsed_atts']['offset'],
529 'show_pagination' => $result['parsed_atts']['show_pagination'],
530 'image_aspect_ratio' => $result['parsed_atts']['image_aspect_ratio'],
531 );
532
533 echo '<div class="aux-isotope-animated"><div class="aux-items-loading aux-loading-hide"><div class="aux-loading-loop"><svg class="aux-circle" width="100%" height="100%" viewBox="0 0 42 42"><circle class="aux-stroke-bg" r="20" cx="21" cy="21" fill="none"></circle><circle class="aux-progress" r="20" cx="21" cy="21" fill="none" transform="rotate(-90 21 21)"></circle></svg></div></div></div>';
534 }
535
536 echo '<div class="'. esc_attr( $column_class ) .'" ' . ( !empty( $show_pagination ) ? "data-widget-data='" . auxin_escape_json( $requiredData ) . "'" : '' ) . ">";
537
538 $have_posts = $wp_query->have_posts();
539
540 if( $have_posts ){
541
542 while ( $wp_query->have_posts() ) {
543
544 $wp_query->the_post();
545 $post = get_post();
546
547 $post_vars = auxin_get_post_type_media_args(
548 $post,
549 array(
550 'post_type' => $post_type,
551 'request_from' => 'element',
552 'media_width' => $phone_break_point,
553 'media_size' => $size,
554 'upscale_image' => true,
555 'image_from_content' => ! $exclude_without_media, // whether to try to get image from content or not
556 'ignore_media' => ! $show_media,
557 'add_image_hw' => false, // whether add width and height attr or not
558 'preloadable' => $preloadable,
559 'preload_preview' => $preload_preview,
560 'preload_bgcolor' => $preload_bgcolor,
561 'image_sizes' => 'auto',
562 'srcset_sizes' => 'auto'
563 )
564 );
565
566 extract( $post_vars );
567 $the_format = get_post_format( $post );
568
569 // add specific class to current classes for each column
570 $post_classes = $has_attach && $show_media ? 'post column-entry' : 'post column-entry no-media';
571
572 // Generate the markup by template parts
573 if( has_action( $base_class . '-template-part' ) ){
574 do_action( $base_class . '-template-part', $result, $post_vars, $item_class );
575
576 } else {
577 ?>
578 <div <?php wc_product_class( $item_class . ' post-'. $post->ID, $post->ID );?>>
579 <?php
580 include auxin_get_template_file( $template_part_file, '', $extra_template_path );
581 echo '</div>';
582 }
583
584 }
585
586 if( ! $skip_wrappers ) {
587 // End tag for aux-ajax-view wrapper
588 echo '</div>';
589 } else {
590 // Get post counter in the query
591 echo '<span class="aux-post-count hidden">'. esc_html( $wp_query->post_count ) .'</span>';
592 echo '<span class="aux-all-posts-count hidden">'. esc_html( $wp_query->found_posts ) .'</span>';
593 }
594
595 if ( !empty( $show_pagination ) ) {
596 echo auxin_the_paginate_nav( [
597 'wp_query' => $wp_query,
598 'current' => $args['paged']
599 ] );
600 }
601
602 }
603
604 if( $reset_query ){
605 wp_reset_postdata();
606 }
607
608 // return false if no result found
609 if( ! $have_posts ){
610 ob_get_clean();
611 return false;
612 }
613
614 // widget custom output -----------------------
615
616
617 // widget footer ------------------------------
618 echo wp_kses_post( $result['widget_footer'] );
619
620 return ob_get_clean();
621 }
622
623 function auxin_ajax_widget_the_recent_products(){
624
625 if ( !isset( $_GET['auxinNonce'] ) || !wp_verify_nonce( $_GET['auxinNonce'], 'auxin-security-nonce' ) ) {
626 die();
627 }
628
629 $args = !empty($_GET['data']) ? auxin_sanitize_input( $_GET['data'] ) : [];
630
631 $args['paged'] = !empty($_GET['paged']) ? sanitize_text_field( $_GET['paged'] ) : $args['paged'];
632
633 echo auxin_widget_the_recent_products_callback( $args );
634 die();
635 }
636 add_action( 'wp_ajax_aux_the_recent_products', 'auxin_ajax_widget_the_recent_products' );
637 add_action( 'wp_ajax_nopriv_aux_the_recent_products', 'auxin_ajax_widget_the_recent_products');