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 / latest-posts-slider.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
latest-posts-slider.php
555 lines
1 <?php
2 /**
3 * Latest Post slider 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 function auxin_get_post_slider_master_array( $master_array ) {
13
14 $master_array['aux_latest_posts_slider'] = array(
15 'name' => __('[Phlox] 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' => 'auxin-element auxin-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' ,
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' ,
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' ,
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' ,
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' ,
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' ,
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' ,
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',
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 'limit_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 'post__not_in' => array_filter( explode( ',', $exclude ) ),
441 'post__in' => array_filter( explode( ',', $include ) ),
442 'post_status' => 'publish',
443 'image_size' => 'full',
444 'posts_per_page' => ( $exclude_without_image ? -1 : $limit_num ),
445 'ignore_sticky_posts' => 1
446 );
447
448
449 $post_counter = 0;
450
451 $query_res = null;
452 $query_res = new WP_Query( $query_args );
453
454 // skip building slider if no post results found
455 if( ! $query_res->have_posts() ){
456 return '';
457 }
458
459 ob_start();
460
461 // widget header ------------------------------
462 echo $result['widget_header'];
463 echo $result['widget_title'];
464
465 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.'">';
466
467 // widget custom output -----------------------
468
469
470 if( $query_res->have_posts() ): while ( $query_res->have_posts() ) : $query_res->the_post();
471
472 // break the loop if it is reached to the limit
473 if ( $exclude_without_image && $post_counter == $limit_num ) {
474 break;
475 } else {
476 $post_counter ++;
477 }
478
479 $slide_image = '';
480
481 // get image
482 if ( 'custom' == $image_from && !empty( $custom_image ) ) {
483 $slide_image = auxin_get_the_resized_image( $custom_image, $width, $height, true , 100 );
484 } else {
485 $slide_image = auxin_get_auto_post_thumbnail( $query_res->post->ID, $image_from, $width, $height, true, 100, true );
486 }
487
488 //skip if post doesn't have image
489 if ( $exclude_without_image && empty( $slide_image ) ) {
490 $post_counter --;
491 continue;
492 }
493 ?>
494 <div class="aux-mc-item" >
495 <div class="aux-slide-media">
496 <div class="aux-media-frame aux-media-image">
497 <?php echo $slide_image; ?>
498 </div>
499 </div>
500 <?php if( $add_title ) { ?>
501 <section class="aux-info-container">
502 <div class="aux-slide-title">
503 <h3><a href="<?php the_permalink(); ?>"><?php echo auxin_get_trimmed_string( get_the_title(), 70, '...'); ?></a></h3>
504 </div>
505 <div class="aux-slide-info">
506 <?php if ( $add_meta ) { ?>
507 <time datetime="<?php echo get_the_date( DATE_W3C ); ?>" title="<?php echo get_the_date( DATE_W3C ); ?>" ><?php the_date(); ?></time>
508 <span class="entry-tax">
509 <?php // the_category(' '); we can use this template tag, but customizable way is needed! ?>
510 <?php $tax_name = 'category';
511 if( $cat_terms = wp_get_post_terms( $query_res->post->ID, $tax_name ) ){
512 foreach( $cat_terms as $term ){
513 echo '<a href="'. get_term_link( $term->slug, $tax_name ) .'" title="'.__("View all posts in ", 'auxin-elements' ). $term->name .'" rel="category" >'. $term->name .'</a>';
514 }
515 }
516 ?>
517 </span>
518 <?php } ?>
519 </div>
520 </section>
521 <?php } ?>
522 </div>
523
524 <?php endwhile;
525
526 // skip building slider if no slide is generated
527 if( ! $post_counter ){
528 ob_get_clean();
529 return '';
530 }
531
532 if ( $arrows ) { ?>
533 <div class="aux-next-arrow aux-arrow-nav aux-white aux-round aux-hover-slide">
534 <span class="aux-overlay"></span>
535 <span class="aux-svg-arrow aux-medium-right"></span>
536 <span class="aux-hover-arrow aux-svg-arrow aux-medium-right"></span>
537 </div>
538 <div class="aux-prev-arrow aux-arrow-nav aux-white aux-round aux-hover-slide">
539 <span class="aux-overlay"></span>
540 <span class="aux-svg-arrow aux-medium-left"></span>
541 <span class="aux-hover-arrow aux-svg-arrow aux-medium-left"></span>
542 </div>
543 <?php
544 }
545 endif;
546 wp_reset_query();
547
548 // widget footer ------------------------------
549 echo '</div><!-- aux-col-wrapper -->';
550
551 echo $result['widget_footer'];
552
553 return ob_get_clean();
554 }
555