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