PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.4
Shortcodes and extra features for Phlox theme v2.17.4
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 / latest-posts-slider.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 1 year 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
latest-posts-slider.php
562 lines
1 <?php
2 /**
3 * Latest Post slider 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 function auxin_get_post_slider_master_array( $master_array ) {
13
14 $master_array['aux_latest_posts_slider'] = array(
15 'name' => __('Latest Posts Slider ', 'auxin-elements' ),
16 'auxin_output_callback' => 'auxin_latest_posts_slider_callback',
17 'base' => 'aux_latest_posts_slider',
18 'description' => __('Slider for latest posts.', 'auxin-elements' ),
19 'class' => 'aux-widget-post-slider',
20 'show_settings_on_create' => true,
21 'weight' => 1,
22 'is_widget' => true,
23 'is_shortcode' => true,
24 'category' => THEME_NAME,
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-post-slider',
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' => __('Latest post slider title, leave it empty if you don`t need title.', 'auxin-elements'),
42 'param_name' => 'title',
43 'type' => 'textfield',
44 'value' => '',
45 'holder' => '',
46 'class' => 'title',
47 'admin_label' => false,
48 'dependency' => '',
49 'weight' => '',
50 'group' => '' ,
51 'edit_field_class' => ''
52 ),
53 array(
54 'heading' => __('Create slides from','auxin-elements' ),
55 'description' => '',
56 'param_name' => 'post_type',
57 'type' => 'dropdown',
58 'def_value' => 'post',
59 'value' => array(
60 'post' => __('Posts', 'auxin-elements' ),
61 'page' => __('Pages', 'auxin-elements' ),
62 ),
63 'holder' => '',
64 'class' => 'border',
65 'admin_label' => true,
66 'dependency' => '',
67 'weight' => '',
68 'group' => __( 'Query', 'auxin-elements' ),
69 'edit_field_class' => ''
70 ),
71 array(
72 'heading' => __('Slides number','auxin-elements' ),
73 'description' => __('Specifies maximum number of slides in slider.', 'auxin-elements' ),
74 'param_name' => 'slides_num',
75 'type' => 'textfield',
76 'value' => '10',
77 'holder' => '',
78 'class' => '',
79 'admin_label' => false,
80 'dependency' => '',
81 'weight' => '',
82 'group' => __( 'Query', 'auxin-elements' ),
83 'edit_field_class' => ''
84 ),
85 array(
86 'heading' => __('Exclude posts','auxin-elements' ),
87 'description' => __('Post IDs separated by comma (eg. 53,34,87,25).', 'auxin-elements' ),
88 'param_name' => 'exclude',
89 'type' => 'textfield',
90 'value' => '',
91 'holder' => '',
92 'class' => '',
93 'admin_label' => false,
94 'dependency' => '',
95 'weight' => '',
96 'group' => __( 'Query', 'auxin-elements' ),
97 'edit_field_class' => ''
98 ),
99 array(
100 'heading' => __('Include posts','auxin-elements' ),
101 'description' => __('Post IDs separated by comma (eg. 53,34,87,25).', 'auxin-elements' ),
102 'param_name' => 'include',
103 'type' => 'textfield',
104 'value' => '',
105 'holder' => '',
106 'class' => '',
107 'admin_label' => false,
108 'dependency' => '',
109 'weight' => '',
110 'group' => __( 'Query', 'auxin-elements' ),
111 'edit_field_class' => ''
112 ),
113 array(
114 'heading' => __('Start offset','auxin-elements' ),
115 'description' => __('Number of post to displace or pass over.', 'auxin-elements' ),
116 'param_name' => 'offset',
117 'type' => 'textfield',
118 'value' => '',
119 'holder' => '',
120 'class' => '',
121 'admin_label' => false,
122 'dependency' => '',
123 'weight' => '',
124 'group' => __( 'Query', 'auxin-elements' ),
125 'edit_field_class' => ''
126 ),
127 array(
128 'heading' => __('Order by','auxin-elements' ),
129 'description' => '',
130 'param_name' => 'order_by',
131 'type' => 'dropdown',
132 'def_value' => 'date',
133 'value' => array(
134 'date' => __('Date', 'auxin-elements' ),
135 'menu_order date' => __('Menu Order', 'auxin-elements' ),
136 'title' => __('Title', 'auxin-elements' ),
137 'ID' => __('ID', 'auxin-elements' ),
138 'rand' => __('Random', 'auxin-elements' ),
139 'comment_count' => __('Comments', 'auxin-elements' ),
140 'modified' => __('Date Modified', 'auxin-elements' ),
141 'author' => __('Author', 'auxin-elements' ),
142 ),
143 'holder' => '',
144 'class' => 'border',
145 'admin_label' => false,
146 'dependency' => '',
147 'weight' => '',
148 'group' => __( 'Query', 'auxin-elements' ),
149 'edit_field_class' => ''
150 ),
151 array(
152 'heading' => __('Order direction','auxin-elements' ),
153 'description' => '',
154 'param_name' => 'order_dir',
155 'type' => 'dropdown',
156 'def_value' => 'DESC',
157 'value' => array(
158 'DESC' => __('Descending', 'auxin-elements' ),
159 'ASC' => __('Ascending', 'auxin-elements' ),
160 ),
161 'holder' => '',
162 'class' => 'border',
163 'admin_label' => false,
164 'dependency' => '',
165 'weight' => '',
166 'group' => __( 'Query', 'auxin-elements' ),
167 'edit_field_class' => ''
168 ),
169 array(
170 'heading' => __('Slider skin','auxin-elements' ),
171 'description' => '',
172 'param_name' => 'skin',
173 'type' => 'dropdown',
174 'def_value' => 'aux-light-skin',
175 'value' => array(
176 'aux-light-skin' => __('Light and boxed', 'auxin-elements' ),
177 'aux-dark-skin' => __('Dark and boxed', 'auxin-elements' ),
178 'aux-full-light-skin' => __('Light overlay', 'auxin-elements' ),
179 'aux-full-dark-skin' => __('Dark overlay', 'auxin-elements' ),
180 ),
181 'holder' => '',
182 'class' => 'border',
183 'admin_label' => false,
184 'dependency' => '',
185 'weight' => '',
186 'group' => '' ,
187 'edit_field_class' => ''
188 ),
189 array(
190 'heading' => __('Insert post title','auxin-elements' ),
191 'description' => '',
192 'param_name' => 'add_title',
193 'type' => 'aux_switch',
194 'value' => '1',
195 'class' => '',
196 'admin_label' => false,
197 'dependency' => '',
198 'weight' => '',
199 'group' => '' ,
200 'edit_field_class' => ''
201 ),
202 array(
203 'heading' => __('Insert post meta','auxin-elements' ),
204 'description' => '',
205 'param_name' => 'add_meta',
206 'type' => 'aux_switch',
207 'value' => '1',
208 'class' => '',
209 'dependency' => array(
210 'element' => 'add_title',
211 'value' => '1'
212 ),
213 'admin_label' => false,
214 'weight' => '',
215 'group' => '' ,
216 'edit_field_class' => ''
217 ),
218
219 array(
220 'heading' => __('Grab the image from','auxin-elements' ),
221 'description' => '',
222 'param_name' => 'image_from',
223 'type' => 'dropdown',
224 'def_value' => 'auto',
225 'value' => array(
226 'auto' => __('Auto select', 'auxin-elements' ),
227 'featured' => __('Featured image', 'auxin-elements' ),
228 'first' => __('First image in post', 'auxin-elements' ),
229 'custom' => __('Custom image', 'auxin-elements' ),
230 ),
231 'holder' => '',
232 'class' => 'border',
233 'admin_label' => false,
234 'dependency' => '',
235 'weight' => '',
236 'group' => __( 'Query', 'auxin-elements' ),
237 'edit_field_class' => ''
238 ),
239 array(
240 'heading' => __('Background image','auxin-elements' ),
241 'description' => '',
242 'param_name' => 'custom_image',
243 'type' => 'attach_image',
244 'value' => '',
245 'class' => '',
246 'admin_label' => false,
247 'dependency' => array(
248 'element' => 'image_from',
249 'value' => 'custom'
250 ),
251 'weight' => '',
252 'group' => '' ,
253 'edit_field_class' => ''
254 ),
255 array(
256 'heading' => __('Exclude posts without image','auxin-elements' ),
257 'description' => '',
258 'param_name' => 'exclude_without_image',
259 'type' => 'aux_switch',
260 'value' => '1',
261 'class' => '',
262 'admin_label' => false,
263 'dependency' => '',
264 'weight' => '',
265 'group' => '' ,
266 'edit_field_class' => ''
267 ),
268
269
270 array(
271 'heading' => __('Slider image width','auxin-elements' ),
272 'param_name' => 'width',
273 'type' => 'textfield',
274 'value' => '960',
275 'holder' => '',
276 'class' => '',
277 'admin_label' => false,
278 'dependency' => '',
279 'weight' => '',
280 'group' => '' ,
281 'edit_field_class' => ''
282 ),
283 array(
284 'heading' => __('Slider image height','auxin-elements' ),
285 'param_name' => 'height',
286 'type' => 'textfield',
287 'value' => '560',
288 'holder' => '',
289 'class' => '',
290 'admin_label' => false,
291 'dependency' => '',
292 'weight' => '',
293 'group' => '' ,
294 'edit_field_class' => ''
295 ),
296 array(
297 'heading' => __('Arrow navigation','auxin-elements' ),
298 'description' => '',
299 'param_name' => 'arrows',
300 'type' => 'aux_switch',
301 'value' => '0',
302 'class' => '',
303 'admin_label' => false,
304 'dependency' => '',
305 'weight' => '',
306 'group' => '' ,
307 'edit_field_class' => ''
308 ),
309 array(
310 'heading' => __('Space between slides','auxin-elements' ),
311 'param_name' => 'space',
312 'type' => 'textfield',
313 'value' => '5',
314 'holder' => '',
315 'class' => '',
316 'admin_label' => false,
317 'dependency' => '',
318 'weight' => '',
319 'group' => '' ,
320 'edit_field_class' => ''
321 ),
322 array(
323 'heading' => __('Looped navigation','auxin-elements' ),
324 'description' => '',
325 'param_name' => 'loop',
326 'type' => 'aux_switch',
327 'value' => '1',
328 'class' => '',
329 'admin_label' => false,
330 'dependency' => '',
331 'weight' => '',
332 'group' => '' ,
333 'edit_field_class' => ''
334 ),
335 array(
336 'heading' => __('Slideshow','auxin-elements' ),
337 'description' => '',
338 'param_name' => 'slideshow',
339 'type' => 'aux_switch',
340 'value' => '0',
341 'class' => '',
342 'admin_label' => false,
343 'dependency' => '',
344 'weight' => '',
345 'group' => '' ,
346 'edit_field_class' => ''
347 ),
348 array(
349 'heading' => __('Slideshow delay in seconds','auxin-elements' ),
350 'param_name' => 'slideshow_delay',
351 'type' => 'textfield',
352 'value' => '2',
353 'holder' => '',
354 'class' => '',
355 'admin_label' => false,
356 'dependency' => array(
357 'element' => 'slideshow',
358 'value' => '1'
359 ),
360 'weight' => '',
361 'group' => '' ,
362 'edit_field_class' => ''
363 ),
364 array(
365 'heading' => __('Extra class name','auxin-elements'),
366 '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'),
367 'param_name' => 'extra_classes',
368 'type' => 'textfield',
369 'value' => '',
370 'def_value' => '',
371 'holder' => '',
372 'class' => 'extra_classes',
373 'admin_label' => false,
374 'dependency' => '',
375 'weight' => '',
376 'group' => '' ,
377 'edit_field_class' => ''
378 )
379 )
380 );
381
382 return $master_array;
383 }
384
385 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_post_slider_master_array', 10, 1 );
386
387 /**
388 * Dynamic element with result in columns
389 * The front-end output of this element is returned by the following function
390 *
391 * @param array $atts The array containing the parsed values from shortcode
392 * containing widget info too
393 * @param string $shortcode_content The shorcode content
394 * @return string The output of element markup
395 */
396 function auxin_latest_posts_slider_callback( $atts, $shortcode_content = null ){
397
398 // Defining default attributes
399 $default_atts = array(
400 'title' => '',
401 'slides_num' => '10',
402 'order_by' => 'date',
403 'order_dir' => 'DESC',
404 'post_type' => 'post',
405 'add_title' => '1',
406 'add_meta' => '1',
407 'image_from' => 'auto',
408 'offset' => '',
409 'include' => '',
410 'exclude_without_image' => '1',
411 'exclude' => '',
412 'custom_image' => '',
413 'skin' => 'aux-light-skin',
414 'width' => '960',
415 'height' => '560',
416 'loop' => '1',
417 'space' => '5',
418 'slideshow' => '0',
419 'slideshow_delay' => '2',
420 'arrows' => '0',
421
422 'extra_classes' => '', // custom css class names for this element
423 'custom_el_id' => '', // custom id attribute for this element
424 'base_class' => 'aux-widget-post-slider' // base class name for container
425 );
426
427 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
428 extract( $result['parsed_atts'] );
429
430 // query --------------------------------------
431
432 // Create wp_query to get pages
433 $query_args = array(
434 'post_type' => $post_type,
435 'orderby' => $order_by,
436 'order' => $order_dir,
437 'offset' => $offset,
438 'posts__not_in' => $exclude,
439 'include_posts__in' => $include,
440 'post_status' => 'publish',
441 'posts_per_page' => $slides_num, // -1 causes ignoring offset
442 'ignore_sticky_posts' => 1
443 );
444
445 $post_counter = 0;
446
447 $query_res = null;
448 $query_res = new WP_Query( auxin_parse_query_args( $query_args ) );
449
450 // skip building slider if no post results found
451 if( ! $query_res->have_posts() ){
452 return '';
453 }
454
455 ob_start();
456
457 // widget header ------------------------------
458 echo wp_kses_post( $result['widget_header'] );
459 echo wp_kses_post( $result['widget_title'] );
460
461 echo '<div class="master-carousel-slider aux-latest-posts-slider aux-no-js '.esc_attr( $skin ).'" data-empty-height="'.esc_attr( $height ).'" data-navigation="peritem" data-space="'.esc_attr( $space ).'" data-auto-height="true" data-delay="'.esc_attr( $slideshow_delay ).'" data-loop="'.esc_attr( $loop ).'" data-autoplay="'.esc_attr( $slideshow ).'">';
462
463 // widget custom output -----------------------
464
465
466 if( $query_res->have_posts() ): while ( $query_res->have_posts() ) : $query_res->the_post();
467
468 // break the loop if it is reached to the limit
469 if ( $exclude_without_image && $post_counter == $slides_num ) {
470 break;
471 } else {
472 $post_counter ++;
473 }
474
475 $slide_image = '';
476
477 // get image
478 if ( 'custom' == $image_from && !empty( $custom_image ) ) {
479 $slide_image = auxin_get_the_resized_image( $custom_image, $width, $height, true , 100 );
480 } else {
481 // $slide_image = auxin_get_auto_post_thumbnail( $query_res->post->ID, $image_from, $width, $height, true, 100, true );
482 $slide_image = auxin_get_the_post_responsive_thumbnail(
483 $query_res->post->ID,
484 array(
485 'size' => array( 'width' => $width, 'height' => $height ),
486 'add_hw' => false,
487 'preloadable' => false,
488 'preload_preview' => true,
489 'image_sizes' => 'auto',
490 'srcset_sizes' => 'auto',
491 )
492 );
493 }
494
495 //skip if post doesn't have image
496 if ( $exclude_without_image && empty( $slide_image ) ) {
497 $post_counter --;
498 continue;
499 }
500 ?>
501 <div class="aux-mc-item" >
502 <div class="aux-slide-media">
503 <div class="aux-media-frame aux-media-image">
504 <?php echo wp_kses_post( $slide_image ); ?>
505 </div>
506 </div>
507 <?php if( $add_title ) { ?>
508 <section class="aux-info-container">
509 <div class="aux-slide-title">
510 <h3><a href="<?php the_permalink(); ?>"><?php echo auxin_get_trimmed_string( get_the_title(), 70, '...'); ?></a></h3>
511 </div>
512 <div class="aux-slide-info">
513 <?php if ( $add_meta ) { ?>
514 <time datetime="<?php echo get_the_date( DATE_W3C ); ?>" title="<?php echo get_the_date( DATE_W3C ); ?>" ><?php echo get_the_date(); ?></time>
515 <span class="entry-tax">
516 <?php // the_category(' '); we can use this template tag, but customizable way is needed! ?>
517 <?php $tax_name = 'category';
518 if( $cat_terms = wp_get_post_terms( $query_res->post->ID, $tax_name ) ){
519 foreach( $cat_terms as $term ){
520 echo '<a href="'. esc_url( get_term_link( $term->slug, $tax_name ) ) .'" title="'.esc_attr__("View all posts in ", 'auxin-elements' ). esc_attr( $term->name ) .'" rel="category" >'. esc_html( $term->name ) .'</a>';
521 }
522 }
523 ?>
524 </span>
525 <?php } ?>
526 </div>
527 </section>
528 <?php } ?>
529 </div>
530
531 <?php endwhile;
532
533 // skip building slider if no slide is generated
534 if( ! $post_counter ){
535 ob_get_clean();
536 return '';
537 }
538
539 if ( $arrows ) { ?>
540 <div class="aux-next-arrow aux-arrow-nav aux-white aux-round aux-hover-slide">
541 <span class="aux-overlay"></span>
542 <span class="aux-svg-arrow aux-medium-right"></span>
543 <span class="aux-hover-arrow aux-svg-arrow aux-medium-right"></span>
544 </div>
545 <div class="aux-prev-arrow aux-arrow-nav aux-white aux-round aux-hover-slide">
546 <span class="aux-overlay"></span>
547 <span class="aux-svg-arrow aux-medium-left"></span>
548 <span class="aux-hover-arrow aux-svg-arrow aux-medium-left"></span>
549 </div>
550 <?php
551 }
552 endif;
553 wp_reset_query();
554
555 // widget footer ------------------------------
556 echo '</div><!-- aux-col-wrapper -->';
557
558 echo wp_kses_post( $result['widget_footer'] );
559
560 return ob_get_clean();
561 }
562