PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 1.0.2
Shortcodes and extra features for Phlox theme v1.0.2
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-widget.php
auxin-elements / includes / elements Last commit date
about-widget.php 10 years ago accordion.php 10 years ago attachment-url.php 10 years ago audio.php 10 years ago button.php 10 years ago code.php 10 years ago contact-box.php 10 years ago contact-form.php 10 years ago divider.php 10 years ago dropcap.php 10 years ago gallery.php 10 years ago gmap.php 10 years ago highlight.php 10 years ago image.php 10 years ago instagram-feed.php 10 years ago latest-items.php 10 years ago latest-posts-slider.php 10 years ago quote.php 10 years ago recent-posts-widget.php 10 years ago recent-posts.php 10 years ago sample-element.php 10 years ago search.php 10 years ago socials-list.php 10 years ago tabs.php 10 years ago text.php 10 years ago video.php 10 years ago
recent-posts-widget.php
342 lines
1 <?php
2 /**
3 * Code highlighter element
4 *
5 *
6 * @package auxin-elements
7 * @license LICENSE.txt
8 * @author
9 * @link https://bitbucket.org/averta/
10 * @copyright (c) 2010-2016
11 */
12
13 function auxin_get_recent_post_widget_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 // $tags = get_terms( 'post_tag', 'orderby=count&hide_empty=0' );
22 // $tags_list;
23 // foreach ($tags as $key => $value) {
24 // $tags_list["$value->term_id"] = $value->name;
25 // }
26
27
28 $master_array['aux_recent_post_widget'] = array(
29 'name' => __('[Phlox] Recent Posts Widget', 'auxin-elements' ),
30 'auxin_output_callback' => 'auxin_widget_recent_post_widget_callback',
31 'base' => 'aux_recent_post_widget',
32 'description' => __('Shows recent posts with thumbnail.', 'auxin-elements' ),
33 'class' => 'aux-widget-recent-post-widget',
34 'show_settings_on_create' => true,
35 'weight' => 1,
36 'is_widget' => true,
37 'is_shortcode' => false,
38 'is_so' => false,
39 'is_vc' => false,
40 'category' => THEME_NAME,
41 'group' => '',
42 'admin_enqueue_js' => '',
43 'admin_enqueue_css' => '',
44 'front_enqueue_js' => '',
45 'front_enqueue_css' => '',
46 'icon' => 'auxin-element auxin-code',
47 'custom_markup' => '',
48 'js_view' => '',
49 'html_template' => '',
50 'deprecated' => '',
51 'content_element' => '',
52 'as_parent' => '',
53 'as_child' => '',
54 'params' => array(
55 array(
56 'param_name' => 'title',
57 'type' => 'textfield',
58 'std' => '',
59 'value' => '',
60 'holder' => 'textfield',
61 'class' => 'title',
62 'heading' => __('Title','auxin-elements' ),
63 'description' => '',
64 'admin_label' => true,
65 'dependency' => '',
66 'weight' => '',
67 'group' => '' ,
68 'edit_field_class' => ''
69 ),
70 array(
71 'param_name' => 'num',
72 'type' => 'dropdown',
73 'def_value' => '4',
74 'holder' => 'dropdown',
75 'class' => 'num',
76 'heading' => __('Number of posts to show', 'auxin-elements'),
77 'description' => '',
78 'value' => array(
79 '1' => '1' , '2' => '2' , '3' => '3' ,
80 '4' => '4' , '5' => '5' , '6' => '6',
81 '7' => '7' , '8' => '8' , '9' => '9' ,
82 '10' => '10','11' => '11' ,'12' => '12'
83 ),
84 'admin_label' => true,
85 'dependency' => '',
86 'weight' => '',
87 'group' => '' ,
88 'edit_field_class' => ''
89 ),
90 array(
91 'param_name' => 'show_media',
92 'type' => 'aux_switch',
93 'def_value' => '',
94 'value' => '1',
95 'holder' => 'dropdown',
96 'class' => 'show_media',
97 'heading' => __('Display Image', 'auxin-elements' ),
98 'description' => __('Enable it to display images as well.','auxin-elements' ),
99 'admin_label' => true,
100 'dependency' => '',
101 'weight' => '',
102 'group' => '' ,
103 'edit_field_class' => ''
104 ),
105 array(
106 'param_name' => 'show_excerpt',
107 'type' => 'aux_switch',
108 'def_value' => '',
109 'value' => '1',
110 'holder' => 'dropdown',
111 'class' => 'show_excerpt',
112 'heading' => __('Display Excerpt','auxin-elements' ),
113 'description' => __('Enable it to display post summary instead of full content.','auxin-elements' ),
114 'admin_label' => 1,
115 'dependency' => '',
116 'weight' => '',
117 'group' => '' ,
118 'edit_field_class' => ''
119 ),
120 array(
121 'param_name' => 'show_date',
122 'type' => 'aux_switch',
123 'def_value' => '',
124 'value' => '1',
125 'holder' => 'dropdown',
126 'class' => 'show_date',
127 'heading' => __('Display post date','auxin-elements' ),
128 'admin_label' => 1,
129 'dependency' => '',
130 'weight' => '',
131 'group' => '' ,
132 'edit_field_class' => ''
133 ),
134 array(
135 'param_name' => 'excerpt_len',
136 'type' => 'textfield',
137 'value' => '60',
138 'holder' => 'textfield',
139 'class' => 'excerpt_len',
140 'heading' => __('Excerpt Length','auxin-elements' ),
141 'description' => __('Specify summary content in character','auxin-elements' ),
142 'admin_label' => 1,
143 'dependency' => '',
144 'weight' => '',
145 'group' => '' ,
146 'edit_field_class' => ''
147 ),
148 array(
149 'param_name' => 'order_by',
150 'type' => 'dropdown',
151 'def_value' => 'date',
152 'holder' => 'dropdown',
153 'class' => 'order_by',
154 'heading' => __('Order By', 'auxin-elements'),
155 'description' => '',
156 'value' => array (
157 'date' => __('Date', 'auxin-elements'),
158 'menu_order date' => __('Menu Order', 'auxin-elements'),
159 'title' => __('Title', 'auxin-elements'),
160 'ID' => __('ID', 'auxin-elements'),
161 'rand' => __('Random', 'auxin-elements'),
162 'comment_count' => __('Comments', 'auxin-elements'),
163 'modified' => __('Date Modified', 'auxin-elements'),
164 'author' => __('Author', 'auxin-elements'),
165 ),
166 'admin_label' => true,
167 'dependency' => '',
168 'weight' => '',
169 'group' => '' ,
170 'edit_field_class' => ''
171 ),
172 array(
173 'param_name' => 'order',
174 'type' => 'dropdown',
175 'def_value' => 'DESC',
176 'holder' => 'dropdown',
177 'class' => 'order',
178 'heading' => __('Order', 'auxin-elements'),
179 'description' => '',
180 'value' =>array (
181 'DESC' => __('Descending', 'auxin-elements'),
182 'ASC' => __('Ascending', 'auxin-elements'),
183 ),
184 'admin_label' => true,
185 'dependency' => '',
186 'weight' => '',
187 'group' => '' ,
188 'edit_field_class' => ''
189 ),
190 array(
191 'param_name' => 'cat',
192 'type' => 'dropdown',
193 'def_value' => 'default',
194 'holder' => 'dropdown',
195 'class' => 'cat',
196 'heading' => __('Categories', 'auxin-elements'),
197 'description' => __('specify a categories that you want.', 'auxin-elements' ),
198 'value' => $categories_list,
199 'admin_label' => true,
200 'dependency' => '',
201 'weight' => '',
202 'group' => '' ,
203 'edit_field_class' => ''
204 ),
205 // array(
206 // 'param_name' => 'tag',
207 // 'type' => 'dropdown',
208 // 'def_value' => '',
209 // 'holder' => 'dropdown',
210 // 'class' => 'tag',
211 // 'heading' => __('Tags', 'auxin-elements'),
212 // 'description' => __('specify a tags that you want.', 'auxin-elements' ),
213 // 'value' => $tags_list,
214 // 'admin_label' => true,
215 // 'dependency' => '',
216 // 'weight' => '',
217 // 'group' => '' ,
218 // 'edit_field_class' => ''
219 // ),
220 array(
221 'param_name' => 'extra_classes',
222 'type' => 'textfield',
223 'value' => '',
224 'def_value' => '',
225 'holder' => 'textfield',
226 'class' => 'extra_classes',
227 'heading' => __('Extra class name','auxin-elements' ),
228 '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' ),
229 'admin_label' => true,
230 'dependency' => '',
231 'weight' => '',
232 'group' => '',
233 'edit_field_class' => ''
234 )
235 )
236 );
237
238 return $master_array;
239 }
240
241 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_recent_post_widget_master_array', 10, 1 );
242
243
244
245
246 /**
247 * Element without loop and column
248 * The front-end output of this element is returned by the following function
249 *
250 * @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above.
251 * @param string $shortcode_content The shorcode content
252 * @return string The output of element markup
253 */
254 function auxin_widget_recent_post_widget_callback( $atts, $shortcode_content = null ){
255
256 // Defining default attributes
257 $default_atts = array(
258 'title' => '', // header title
259 'num' => '4',
260 'show_media' => 1,
261 'show_excerpt' => 1,
262 'show_date' => 1,
263 'excerpt_len' => '60',
264 'order' => 'desc',
265 'order_by' => 'date',
266 'cat' => '',
267 'tag' => '',
268 'extra_classes' => '',
269 'custom_el_id' => '',
270 'base_class' => 'aux-widget-recent-post-widget'
271 );
272
273 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
274 extract( $result['parsed_atts'] );
275
276 ob_start();
277
278
279
280 // create wp_query to get latest items -----------
281 $args = array(
282 'post_type' => 'post',
283 'orderby' => $order_by,
284 'order' => $order,
285 'post_status' => 'publish',
286 'posts_per_page' => $num,
287 'cat' => $cat,
288 // 'tag_id' => $tag,
289 'ignore_sticky_posts' => 1
290 );
291
292 $th_query = null;
293 $th_query = new WP_Query( $args );
294
295 $show_format = 'false'; // @TODO
296
297 // widget header ------------------------------
298 echo $result['widget_header'];
299 echo $result['widget_title'];
300
301 if( $th_query->have_posts() ): while ($th_query->have_posts()) : $th_query->the_post(); ?>
302
303 <article class="media-land">
304 <?php if( $show_media == true && $entry_media = auxin_get_the_post_thumbnail( null, 160, 160, true ) ) { ?>
305 <?php //if( $entry_media = auxin_get_the_post_thumbnail( null, 160, 160, true ) ) { ?>
306 <div class="entry-media">
307 <div class="aux-media-frame aux-media-image">
308 <a href="<?php the_permalink(); ?>">
309 <?php echo $entry_media; ?>
310 </a>
311 </div>
312 </div>
313 <?php } if( $show_format ) { ?>
314 <div class="entry-format">
315 <a href="<?php the_permalink(); ?>" class="post-format format-<?php echo get_post_format(); ?>"></a>
316 </div>
317 <?php } ?>
318 <div>
319 <header class="entry-header">
320 <h4 class="entry-title"><a href="<?php the_permalink(); ?>"><?php echo auxin_get_trimmed_string( get_the_title(), 40, '...'); ?></a></h4>
321 </header>
322
323 <div class="entry-content">
324 <?php if($show_date != false ) { ?>
325 <time datetime="<?php the_time('Y-m-d')?>" title="<?php the_time('Y-m-d')?>" ><?php the_time('F j, Y'); ?></time>
326 <?php } if( $show_excerpt != false ) { ?>
327 <p><?php auxin_the_trim_excerpt( null, (int) $excerpt_len, null, true ); ?></p>
328 <?php } ?>
329 </div>
330 </div>
331 </article>
332
333
334 <?php endwhile; endif;
335 wp_reset_query();
336
337 // widget footer ------------------------------
338 echo $result['widget_footer'];
339
340 return ob_get_clean();
341 }
342