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