PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.14
Shortcodes and extra features for Phlox theme v2.17.14
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-posts-timeline.php
auxin-elements / includes / elements Last commit date
about-widget.php 1 year ago accordion-widget.php 1 year ago accordion.php 1 year ago attachment-url.php 1 year ago audio.php 1 year ago before-after.php 1 year ago button.php 1 year ago code.php 1 year ago contact-box.php 1 year ago contact-form.php 1 year ago custom-list.php 6 months ago divider.php 1 year ago dropcap.php 1 year ago facebook.php 1 year ago flickr.php 1 year ago gallery.php 1 year ago gmap.php 1 year ago highlight.php 1 year ago image.php 1 year ago instagram-feed.php 1 year ago latest-posts-slider.php 1 year ago popular-posts-widget.php 1 year ago products-grid.php 1 year ago quote.php 1 year ago recent-posts-grid-carousel.php 1 year ago recent-posts-land-style.php 1 year ago recent-posts-masonry.php 1 year ago recent-posts-tiles-carousel.php 1 year ago recent-posts-tiles.php 1 year ago recent-posts-timeline.php 1 year ago recent-posts-widget.php 1 year ago recent-products.php 1 year ago related-posts.php 8 years ago sample-element.php 1 year ago search.php 1 year ago socials-list.php 1 year ago staff.php 1 year ago tab-widget.php 1 year ago tabs.php 1 year ago testimonial.php 1 year ago text.php 1 year ago touch-slider.php 1 year ago video.php 1 year ago
recent-posts-timeline.php
681 lines
1 <?php
2 /**
3 * Code highlighter element
4 *
5 *
6 * @package Auxin
7 * @license LICENSE.txt
8 * @author averta
9 * @link http://phlox.pro/
10 * @copyright (c) 2010-2025 averta
11 */
12
13 function auxin_get_recent_posts_timeline_master_array( $master_array ) {
14
15 $categories = get_terms([
16 'taxonomy' => 'category',
17 'orderby' => 'count',
18 'hide_empty' => false,
19 ]);
20 $categories_list = array( ' ' => __('All Categories', 'auxin-elements' ) ) ;
21 foreach ( $categories as $key => $value ) {
22 $categories_list[$value->term_id] = $value->name;
23 }
24
25
26 $master_array['aux_recent_posts_timeline'] = array(
27 'name' => __('Timeline Recent Posts', 'auxin-elements' ),
28 'auxin_output_callback' => 'auxin_widget_recent_posts_timeline_callback',
29 'base' => 'aux_recent_posts_timeline',
30 'description' => __('It adds recent posts in timeline style.', 'auxin-elements' ),
31 'class' => 'aux-widget-recent-posts-timeline aux-column-post-entry',
32 'show_settings_on_create' => true,
33 'weight' => 1,
34 'is_widget' => false,
35 'is_shortcode' => true,
36 'category' => THEME_NAME,
37 'group' => '',
38 'admin_enqueue_js' => '',
39 'admin_enqueue_css' => '',
40 'front_enqueue_js' => '',
41 'front_enqueue_css' => '',
42 'icon' => 'aux-element aux-pb-icons-timeline',
43 'custom_markup' => '',
44 'js_view' => '',
45 'html_template' => '',
46 'deprecated' => '',
47 'content_element' => '',
48 'as_parent' => '',
49 'as_child' => '',
50 'params' => array(
51 array(
52 'heading' => __('Title','auxin-elements' ),
53 'description' => __('Recent post title, leave it empty if you don`t need title.', 'auxin-elements'),
54 'param_name' => 'title',
55 'type' => 'textfield',
56 'std' => '',
57 'value' => '',
58 'holder' => '',
59 'class' => 'title',
60 'admin_label' => false,
61 'dependency' => '',
62 'weight' => '',
63 'group' => '',
64 'edit_field_class' => ''
65 ),
66 array(
67 'heading' => __('Categories', 'auxin-elements'),
68 'description' => __('Specifies a category that you want to show posts from it.', 'auxin-elements' ),
69 'param_name' => 'cat',
70 'type' => 'aux_select2_multiple',
71 'def_value' => ' ',
72 'holder' => '',
73 'class' => 'cat',
74 'value' => $categories_list,
75 'admin_label' => true,
76 'dependency' => '',
77 'weight' => '',
78 'group' => __( 'Query', 'auxin-elements' ),
79 'edit_field_class' => ''
80 ),
81 array(
82 'heading' => __('Number of posts to show', 'auxin-elements'),
83 'description' => '',
84 'param_name' => 'num',
85 'type' => 'textfield',
86 'value' => '8',
87 'holder' => '',
88 'class' => 'num',
89 'admin_label' => false,
90 'dependency' => '',
91 'weight' => '',
92 'group' => __( 'Query', 'auxin-elements' ),
93 'edit_field_class' => ''
94 ),
95 array(
96 'heading' => __('Exclude posts without media','auxin-elements' ),
97 'description' => '',
98 'param_name' => 'exclude_without_media',
99 'type' => 'aux_switch',
100 'value' => '0',
101 'class' => '',
102 'admin_label' => false,
103 'dependency' => '',
104 'weight' => '',
105 'group' => __( 'Query', 'auxin-elements' ),
106 'edit_field_class' => ''
107 ),
108 array(
109 'heading' => __('Exclude all custom post formats','auxin-elements' ),
110 'description' => '',
111 'param_name' => 'exclude_custom_post_formats',
112 'type' => 'aux_switch',
113 'value' => '0',
114 'class' => '',
115 'admin_label' => false,
116 'dependency' => '',
117 'weight' => '',
118 'group' => __( 'Query', 'auxin-elements' ),
119 'edit_field_class' => ''
120 ),
121 array(
122 'heading' => __('Exclude quote and link post formats','auxin-elements' ),
123 'description' => '',
124 'param_name' => 'exclude_quote_link',
125 'type' => 'aux_switch',
126 'value' => '1',
127 'class' => '',
128 'admin_label' => false,
129 'dependency' => array(
130 'element' => 'exclude_custom_post_formats',
131 'value' => '0'
132 ),
133 'weight' => '',
134 'group' => __( 'Query', 'auxin-elements' ),
135 'edit_field_class' => ''
136 ),
137 array(
138 'heading' => __('Load More Type','auxin-elements' ),
139 'description' => '',
140 'param_name' => 'loadmore_type',
141 'type' => 'aux_visual_select',
142 'value' => 'scroll',
143 'class' => 'loadmore_type',
144 'admin_label' => false,
145 'dependency' => '',
146 'weight' => '',
147 'group' => '' ,
148 'edit_field_class' => '',
149 'choices' => array(
150 '' => array(
151 'label' => __('None', 'auxin-elements' ),
152 'image' => AUXIN_URL . 'images/visual-select/load-more-none.svg'
153 ),
154 'scroll' => array(
155 'label' => __('Infinite Scroll', 'auxin-elements' ),
156 'image' => AUXIN_URL . 'images/visual-select/load-more-infinite.svg'
157 ),
158 'next' => array(
159 'label' => __('Next Button', 'auxin-elements' ),
160 'image' => AUXIN_URL . 'images/visual-select/load-more-button.svg'
161 ),
162 'next-prev' => array(
163 'label' => __('Next Prev', 'auxin-elements' ),
164 'image' => AUXIN_URL . 'images/visual-select/load-more-next-prev.svg'
165 )
166 )
167 ),
168 array(
169 'heading' => __('Order by', 'auxin-elements'),
170 'description' => '',
171 'param_name' => 'order_by',
172 'type' => 'dropdown',
173 'def_value' => 'date',
174 'holder' => '',
175 'class' => 'order_by',
176 'value' => array (
177 'date' => __('Date', 'auxin-elements'),
178 'menu_order date' => __('Menu Order', 'auxin-elements'),
179 'title' => __('Title', 'auxin-elements'),
180 'ID' => __('ID', 'auxin-elements'),
181 'rand' => __('Random', 'auxin-elements'),
182 'comment_count' => __('Comments', 'auxin-elements'),
183 'modified' => __('Date Modified', 'auxin-elements'),
184 'author' => __('Author', 'auxin-elements'),
185 'post__in' => __('Inserted Post IDs', 'auxin-elements')
186 ),
187 'admin_label' => false,
188 'dependency' => '',
189 'weight' => '',
190 'group' => __( 'Query', 'auxin-elements' ),
191 'edit_field_class' => ''
192 ),
193 array(
194 'heading' => __('Order', 'auxin-elements'),
195 'description' => '',
196 'param_name' => 'order',
197 'type' => 'dropdown',
198 'def_value' => 'DESC',
199 'holder' => '',
200 'class' => 'order',
201 'value' =>array (
202 'DESC' => __('Descending', 'auxin-elements'),
203 'ASC' => __('Ascending', 'auxin-elements'),
204 ),
205 'admin_label' => false,
206 'dependency' => '',
207 'weight' => '',
208 'group' => __( 'Query', 'auxin-elements' ),
209 'edit_field_class' => ''
210 ),
211 array(
212 'heading' => __('Only posts','auxin-elements' ),
213 'description' => __('If you intend to display ONLY specific posts, you should specify the posts here. You have to insert the post IDs that are separated by comma (eg. 53,34,87,25).', 'auxin-elements' ),
214 'param_name' => 'only_posts__in',
215 'type' => 'textfield',
216 'value' => '',
217 'holder' => '',
218 'class' => '',
219 'admin_label' => false,
220 'dependency' => '',
221 'weight' => '',
222 'group' => __( 'Query', 'auxin-elements' ),
223 'edit_field_class' => ''
224 ),
225 array(
226 'heading' => __('Include posts','auxin-elements' ),
227 'description' => __('If you intend to include additional posts, you should specify the posts here. You have to insert the Post IDs that are separated by comma (eg. 53,34,87,25)', 'auxin-elements' ),
228 'param_name' => 'include',
229 'type' => 'textfield',
230 'value' => '',
231 'holder' => '',
232 'class' => '',
233 'admin_label' => false,
234 'dependency' => '',
235 'weight' => '',
236 'group' => __( 'Query', 'auxin-elements' ),
237 'edit_field_class' => ''
238 ),
239 array(
240 'heading' => __('Exclude posts','auxin-elements' ),
241 'description' => __('If you intend to exclude specific posts from result, you should specify the posts here. You have to insert the Post IDs that are separated by comma (eg. 53,34,87,25)', 'auxin-elements' ),
242 'param_name' => 'exclude',
243 'type' => 'textfield',
244 'value' => '',
245 'holder' => '',
246 'class' => '',
247 'admin_label' => false,
248 'dependency' => '',
249 'weight' => '',
250 'group' => __( 'Query', 'auxin-elements' ),
251 'edit_field_class' => ''
252 ),
253 array(
254 'heading' => __('Start offset','auxin-elements' ),
255 'description' => __('Number of post to displace or pass over.', 'auxin-elements' ),
256 'param_name' => 'offset',
257 'type' => 'textfield',
258 'value' => '',
259 'holder' => '',
260 'class' => '',
261 'admin_label' => false,
262 'dependency' => '',
263 'weight' => '',
264 'group' => __( 'Query', 'auxin-elements' ),
265 'edit_field_class' => ''
266 ),
267 array(
268 'heading' => __('Timeline aignment','auxin-elements' ),
269 'description' => __('Specifies the alignment of timeline element.', 'auxin-elements'),
270 'param_name' => 'timeline_alignment',
271 'type' => 'aux_visual_select',
272 'choices' => array(
273 'center' => array(
274 'label' => __('Center', 'auxin-elements'),
275 'image' => AUXIN_URL . 'images/visual-select/blog-layout-8.svg'
276 ),
277 'left' => array(
278 'label' => __('Left', 'auxin-elements'),
279 'image' => AUXIN_URL . 'images/visual-select/blog-layout-8-left.svg'
280 ),
281 'right' => array(
282 'label' => __('Right', 'auxin-elements'),
283 'image' => AUXIN_URL . 'images/visual-select/blog-layout-8-right.svg'
284 )
285 ),
286 'value' => 'center',
287 'class' => '',
288 'dependency' => '',
289 'admin_label' => false,
290 'weight' => '',
291 'group' => __( 'Layout', 'auxin-elements' ),
292 'edit_field_class' => ''
293 ),
294 array(
295 'heading' => __('Image aspect ratio', 'auxin-elements'),
296 'description' => '',
297 'param_name' => 'image_aspect_ratio',
298 'type' => 'dropdown',
299 'def_value' => '0.75',
300 'holder' => '',
301 'class' => 'order',
302 'value' =>array (
303 '0.75' => __('Horizontal 4:3' , 'auxin-elements'),
304 '0.56' => __('Horizontal 16:9', 'auxin-elements'),
305 '1.00' => __('Square 1:1' , 'auxin-elements'),
306 '1.33' => __('Vertical 3:4' , 'auxin-elements')
307 ),
308 'admin_label' => false,
309 'dependency' => '',
310 'weight' => '',
311 'group' => __( 'Layout', 'auxin-elements' ),
312 'edit_field_class' => ''
313 ),
314 array(
315 'heading' => __('Display post media (image, video, etc)', 'auxin-elements' ),
316 'param_name' => 'show_media',
317 'type' => 'aux_switch',
318 'def_value' => '',
319 'value' => '1',
320 'holder' => '',
321 'class' => 'show_media',
322 'admin_label' => false,
323 'dependency' => '',
324 'weight' => '',
325 'group' => '',
326 'edit_field_class' => ''
327 ),
328 array(
329 'heading' => __('Display post title','auxin-elements' ),
330 'description' => '',
331 'param_name' => 'display_title',
332 'type' => 'aux_switch',
333 'value' => '1',
334 'class' => 'display_title',
335 'admin_label' => false,
336 'dependency' => '',
337 'weight' => '',
338 'group' => '',
339 'edit_field_class' => ''
340 ),
341 array(
342 'heading' => __('Display post meta','auxin-elements' ),
343 'description' => '',
344 'param_name' => 'show_info',
345 'type' => 'aux_switch',
346 'value' => '1',
347 'class' => '',
348 'admin_label' => false,
349 'weight' => '',
350 'group' => '',
351 'edit_field_class' => ''
352 ),
353 array(
354 'heading' => __('Display excerpt','auxin-elements' ),
355 'description' => __('Enable it to display post summary instead of full content.','auxin-elements' ),
356 'param_name' => 'show_excerpt',
357 'type' => 'aux_switch',
358 'def_value' => '',
359 'value' => '1',
360 'holder' => '',
361 'class' => 'show_excerpt',
362 'admin_label' => false,
363 'dependency' => '',
364 'weight' => '',
365 'group' => '',
366 'edit_field_class' => ''
367 ),
368 array(
369 'heading' => __('Excerpt length','auxin-elements' ),
370 'description' => __('Specify summary content in character.','auxin-elements' ),
371 'param_name' => 'excerpt_len',
372 'type' => 'textfield',
373 'value' => '160',
374 'holder' => '',
375 'class' => 'excerpt_len',
376 'admin_label' => false,
377 'dependency' => array(
378 'element' => 'show_excerpt',
379 'value' => '1'
380 ),
381 'weight' => '',
382 'group' => '',
383 'edit_field_class' => ''
384 ),
385 array(
386 'heading' => __('Display author or read more', 'auxin-elements'),
387 'description' => __('Specifies whether to show author or read more on each post.', 'auxin-elements'),
388 'param_name' => 'author_or_readmore',
389 'type' => 'dropdown',
390 'def_value' => 'readmore',
391 'holder' => '',
392 'class' => 'author_or_readmore',
393 'value' =>array (
394 'readmore' => __('Read More', 'auxin-elements'),
395 'author' => __('Author Name', 'auxin-elements'),
396 ),
397 'admin_label' => false,
398 'dependency' => '',
399 'weight' => '',
400 'group' => '',
401 'edit_field_class' => ''
402 ),
403 array(
404 'heading' => __('Extra class name','auxin-elements' ),
405 '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' ),
406 'param_name' => 'extra_classes',
407 'type' => 'textfield',
408 'value' => '',
409 'holder' => '',
410 'class' => 'extra_classes',
411 'admin_label' => false,
412 'dependency' => '',
413 'weight' => '',
414 'group' => '',
415 'edit_field_class' => ''
416 )
417 )
418 );
419
420 return $master_array;
421 }
422
423 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_recent_posts_timeline_master_array', 10, 1 );
424
425
426
427
428 /**
429 *
430 *
431 * @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above.
432 * @param string $shortcode_content The shorcode content
433 * @return string The output of element markup
434 */
435 function auxin_widget_recent_posts_timeline_callback( $atts, $shortcode_content = null ){
436
437 // Defining default attributes
438 $default_atts = array(
439 'title' => '', // header title
440 'cat' => ' ',
441 'num' => '8',
442 'only_posts__in' => '', // display only these post IDs. array or string comma separated
443 'include' => '', // include these post IDs in result too. array or string comma separated
444 'exclude' => '', // exclude these post IDs from result. array or string comma separated
445 'paged' => '',
446 'offset' => '',
447 'order_by' => 'date',
448 'order' => 'DESC',
449 'exclude_without_media' => 0,
450 'exclude_custom_post_formats' => 0,
451 'exclude_quote_link' => 1,
452 'exclude_post_formats_in' => array(), // the list od post formats to exclude
453 'show_media' => true,
454 'show_excerpt' => true,
455 'show_content' => true,
456 'excerpt_len' => 160,
457 'excerpt_length' => '',
458 'image_aspect_ratio' => 0.75,
459 'display_title' => true,
460 'show_info' => true,
461 'show_date' => true,
462 'author_or_readmore' => 'readmore',
463 'display_author_footer' => false,
464 'display_author_header' => true,
465 'timeline_alignment' => 'center',
466 'display_like' => true,
467 'display_comments' => true,
468 'display_categories' => true,
469 'tag' => '',
470
471 'crop' => false,
472 'preloadable' => false,
473 'preload_preview' => true,
474 'preload_bgcolor' => '',
475 'taxonomy_name' => 'category',
476
477 'extra_classes' => '',
478 'extra_column_classes' => '',
479 'custom_el_id' => '',
480
481 'template_part_file' => 'theme-parts/entry/post-column',
482 'extra_template_path' => '',
483
484 'universal_id' => '',
485 'reset_query' => true,
486 'use_wp_query' => false, // true to use the global wp_query, false to use internal custom query
487 'wp_query_args' => array(), // additional wp_query args
488 'loadmore_type' => '', // 'next' (more button), 'scroll', 'next-prev'
489 'loadmore_per_page' => '',
490 'base' => 'aux_recent_posts_timeline',
491 'base_class' => 'aux-widget-recent-posts-timeline aux-column-post-entry'
492 );
493
494 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
495 extract( $result['parsed_atts'] );
496
497 $acceptedTemplateFiles = apply_filters( 'auxin_recent_posts_timeline_accepted_template_files', [
498 'theme-parts/entry/post-column',
499 'theme-parts/entry/post-flip',
500 'theme-parts/entry/post-land',
501 'theme-parts/entry/post-tile',
502 'theme-parts/entry/post',
503 ]);
504
505 if ( ! in_array( $template_part_file, $acceptedTemplateFiles ) ) {
506 return;
507 }
508
509 $display_author_footer = auxin_is_true( $display_author_footer );
510 $display_author_header = auxin_is_true( $display_author_header );
511
512 // specify the post formats that should be excluded -------
513 $exclude_post_formats_in = (array) $exclude_post_formats_in;
514
515 if( $exclude_custom_post_formats ){
516 $exclude_post_formats_in = array_merge( $exclude_post_formats_in, array( 'aside', 'gallery', 'image', 'link', 'quote', 'video', 'audio' ) );
517 }
518 if( $exclude_quote_link ){
519 $exclude_post_formats_in[] = 'quote';
520 $exclude_post_formats_in[] = 'link';
521 }
522 $exclude_post_formats_in = array_unique( $exclude_post_formats_in );
523
524 // --------------
525
526 ob_start();
527
528 $tax_args = array();
529 if( ! empty( $cat ) && $cat != " " && ( ! is_array( $cat ) || ! in_array( " ", $cat ) ) ) {
530 $tax_args = array(
531 array(
532 'taxonomy' => $taxonomy_name,
533 'field' => 'term_id',
534 'terms' => ! is_array( $cat ) ? explode( ",", $cat ) : $cat
535 )
536 );
537 }
538
539 global $wp_query;
540
541 if( ! $use_wp_query ){
542
543 // create wp_query to get latest items -----------
544 $args = array(
545 'post_type' => 'post',
546 'orderby' => $order_by,
547 'order' => $order,
548 'offset' => $offset,
549 'paged' => $paged,
550 'tax_query' => $tax_args,
551 'post__not_in' => array_filter( explode( ',', $exclude ) ),
552 'post__in' => array_filter( explode( ',', $include ) ),
553 'post_status' => 'publish',
554 'posts_per_page' => $num,
555 'ignore_sticky_posts' => 1,
556 'include_posts__in' => $include, // include posts in this liat
557 'posts__not_in' => $exclude, // exclude posts in this list
558 'posts__in' => $only_posts__in, // only posts in this list
559
560 'exclude_without_media' => $exclude_without_media,
561 'exclude_post_formats_in' => $exclude_post_formats_in
562 );
563
564 // ---------------------------------------------------------------------
565
566 // add the additional query args if available
567 if( $wp_query_args ){
568 $args = wp_parse_args( $args, $wp_query_args );
569 }
570
571 // pass the args through the auxin query parser
572 $wp_query = new WP_Query( auxin_parse_query_args( $args ) );
573 }
574
575 // widget header ------------------------------
576 echo wp_kses_post( $result['widget_header'] );
577 echo wp_kses_post( $result['widget_title'] );
578
579
580 $phone_break_point = 767;
581 $tablet_break_point = 1025;
582
583 $show_comments = true; // shows comments icon
584 $wrapper_class = 'aux-timeline aux-ajax-view aux-'.$timeline_alignment;
585 $item_class = 'aux-block';
586 $post_classes = 'post';
587 $post_info_position = 'after-title';
588 $previous_post_month = '';
589
590 if( ! empty( $loadmore_type ) ) {
591 $item_class .= ' aux-ajax-item';
592 }
593
594 // calculate the media width
595 $column_media_width = 'center' == $timeline_alignment ? $content_width / 2 : $content_width;
596 $size = array( 'width' => $column_media_width, 'height' => $column_media_width * $image_aspect_ratio );
597
598 // whether any result was found or not
599 $have_posts = $wp_query->have_posts();
600
601 if( $have_posts ){
602
603 echo ! $skip_wrappers ? sprintf( '<div data-element-id="%s" class="%s" data-layout="%s">', esc_attr( $universal_id ), esc_attr( $wrapper_class ), esc_attr( $timeline_alignment ) ) : '';
604
605 while ( $wp_query->have_posts() ) {
606
607 $wp_query->the_post();
608 $post = $wp_query->post;
609
610 $post_vars = auxin_get_post_format_media(
611 $post,
612 array(
613 'post_type' => 'post',
614 'request_from' => 'archive',
615 'media_width' => $phone_break_point,
616 'media_size' => $size,
617 'upscale_image' => true,
618 'crop' => $crop,
619 'image_from_content' => ! $exclude_without_media, // whether to try to get image from content or not
620 'ignore_media' => ! $show_media,
621 'add_image_hw' => false, // whether add width and height attr or not
622 'preloadable' => $preloadable,
623 'preload_preview' => $preload_preview,
624 'preload_bgcolor' => $preload_bgcolor,
625 'image_sizes' => 'auto',
626 'srcset_sizes' => 'auto'
627 )
628 );
629
630 extract( $post_vars );
631
632 // get the post format
633 $the_format = get_post_format( $post );
634
635 // get current post month
636 $post_month = get_the_date('m');
637
638 // add month label on timeline main line
639 if( $post_month != $previous_post_month ){
640 ?><span class="aux-date-label"><?php the_date('F'); ?></span><?php
641 }
642
643 printf( '<div class="%s post-%s">', esc_attr( $item_class ), esc_attr( $post->ID ) );
644 include auxin_get_template_file( $template_part_file, '', $extra_template_path );
645 echo '</div>';
646
647 $previous_post_month = $post_month;
648 }
649
650 if( ! $skip_wrappers ) {
651 // End tag for aux-ajax-view wrapper
652 echo '</div>';
653 // Execute load more functionality
654 if( $wp_query->found_posts > $loadmore_per_page ) {
655 echo auxin_get_load_more_controller( $loadmore_type );
656 }
657
658 } else {
659 // Get post counter in the query
660 echo '<span class="aux-post-count hidden">'. esc_html( $wp_query->post_count ) .'</span>';
661 echo '<span class="aux-all-posts-count hidden">'. esc_html( $wp_query->found_posts ) .'</span>';
662 }
663
664 }
665
666 if( $reset_query ){
667 wp_reset_query();
668 }
669
670 // return false if no result found
671 if( ! $have_posts ){
672 ob_get_clean();
673 return false;
674 }
675
676 // widget footer -----------------------
677 echo wp_kses_post( $result['widget_footer'] );
678
679 return ob_get_clean();
680 }
681