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