PluginProbe ʕ •ᴥ•ʔ
Shortcodes and extra features for Phlox theme / 2.17.14
Shortcodes and extra features for Phlox theme v2.17.14
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 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 6 months 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
recent-posts-widget.php
306 lines
1 <?php
2 /**
3 * Code highlighter 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
13 function auxin_get_recent_post_widget_master_array( $master_array ) {
14
15 $categories = get_terms([
16 'taxonomy' => 'category',
17 'orderby' => 'count',
18 'hide_empty' => false,
19 ]);
20 $categories_list = array( '' => __('All Categories', 'auxin-elements' ) );
21 foreach ( $categories as $key => $value ) {
22 $categories_list[$value->term_id] = $value->name;
23 }
24
25 // $tags = get_terms( 'post_tag', 'orderby=count&hide_empty=0' );
26 // $tags_list;
27 // foreach ($tags as $key => $value) {
28 // $tags_list["$value->term_id"] = $value->name;
29 // }
30
31
32 $master_array['aux_recent_post_widget'] = array(
33 'name' => __('Recent Posts Widget', 'auxin-elements' ),
34 'auxin_output_callback' => 'auxin_widget_recent_post_widget_callback',
35 'base' => 'aux_recent_post_widget',
36 'description' => __('Shows recent posts with thumbnail.', 'auxin-elements' ),
37 'class' => 'aux-widget-recent-post-widget',
38 'show_settings_on_create' => true,
39 'weight' => 1,
40 'is_widget' => true,
41 'is_shortcode' => false,
42 'category' => THEME_NAME,
43 'group' => '',
44 'admin_enqueue_js' => '',
45 'admin_enqueue_css' => '',
46 'front_enqueue_js' => '',
47 'front_enqueue_css' => '',
48 'icon' => 'aux-element aux-pb-icons-code',
49 'custom_markup' => '',
50 'js_view' => '',
51 'html_template' => '',
52 'deprecated' => '',
53 'content_element' => '',
54 'as_parent' => '',
55 'as_child' => '',
56 'params' => array(
57 array(
58 'heading' => __('Title','auxin-elements' ),
59 'description' => '',
60 'param_name' => 'title',
61 'type' => 'textfield',
62 'std' => '',
63 'value' => '',
64 'holder' => 'textfield',
65 'class' => 'title',
66 'admin_label' => true,
67 'dependency' => '',
68 'weight' => '',
69 'group' => '' ,
70 'edit_field_class' => ''
71 ),
72 array(
73 'heading' => __('Number of posts to show', 'auxin-elements'),
74 'description' => '',
75 'param_name' => 'num',
76 'type' => 'dropdown',
77 'def_value' => '4',
78 'holder' => '',
79 'class' => 'num',
80 'value' => array(
81 '1' => '1' , '2' => '2' , '3' => '3' ,
82 '4' => '4' , '5' => '5' , '6' => '6',
83 '7' => '7' , '8' => '8' , '9' => '9' ,
84 '10' => '10','11' => '11' ,'12' => '12'
85 ),
86 'admin_label' => true,
87 'dependency' => '',
88 'weight' => '',
89 'group' => '' ,
90 'edit_field_class' => ''
91 ),
92 array(
93 'heading' => __('Display image', 'auxin-elements' ),
94 'description' => __('Enable it to display images as well.','auxin-elements' ),
95 'param_name' => 'show_media',
96 'type' => 'aux_switch',
97 'def_value' => '',
98 'value' => '1',
99 'holder' => '',
100 'class' => 'show_media',
101 'admin_label' => true,
102 'dependency' => '',
103 'weight' => '',
104 'group' => '' ,
105 'edit_field_class' => ''
106 ),
107 array(
108 'heading' => __('Display excerpt','auxin-elements' ),
109 'description' => __('Enable it to display post summary instead of full content.','auxin-elements' ),
110 'param_name' => 'show_excerpt',
111 'type' => 'aux_switch',
112 'def_value' => '',
113 'value' => '1',
114 'holder' => '',
115 'class' => 'show_excerpt',
116 'admin_label' => 1,
117 'dependency' => '',
118 'weight' => '',
119 'group' => '' ,
120 'edit_field_class' => ''
121 ),
122 array(
123 'heading' => __('Display post date','auxin-elements' ),
124 'param_name' => 'show_date',
125 'type' => 'aux_switch',
126 'def_value' => '',
127 'value' => '1',
128 'holder' => '',
129 'class' => 'show_date',
130 'admin_label' => 1,
131 'dependency' => '',
132 'weight' => '',
133 'group' => '' ,
134 'edit_field_class' => ''
135 ),
136 array(
137 'heading' => __('Excerpt length','auxin-elements' ),
138 'description' => __('Specify summary content in character','auxin-elements' ),
139 'param_name' => 'excerpt_len',
140 'type' => 'textfield',
141 'value' => '60',
142 'holder' => 'textfield',
143 'class' => 'excerpt_len',
144 'admin_label' => 1,
145 'dependency' => '',
146 'weight' => '',
147 'group' => '' ,
148 'edit_field_class' => ''
149 ),
150 array(
151 'heading' => __('Order by', 'auxin-elements'),
152 'description' => '',
153 'param_name' => 'order_by',
154 'type' => 'dropdown',
155 'def_value' => 'date',
156 'holder' => 'dropdown',
157 'class' => 'order_by',
158 'value' => array (
159 'date' => __('Date', 'auxin-elements'),
160 'menu_order date' => __('Menu Order', 'auxin-elements'),
161 'title' => __('Title', 'auxin-elements'),
162 'ID' => __('ID', 'auxin-elements'),
163 'rand' => __('Random', 'auxin-elements'),
164 'comment_count' => __('Comments', 'auxin-elements'),
165 'modified' => __('Date Modified', 'auxin-elements'),
166 'author' => __('Author', 'auxin-elements'),
167 ),
168 'admin_label' => true,
169 'dependency' => '',
170 'weight' => '',
171 'group' => '' ,
172 'edit_field_class' => ''
173 ),
174 array(
175 'heading' => __('Order', 'auxin-elements'),
176 'description' => '',
177 'param_name' => 'order',
178 'type' => 'dropdown',
179 'def_value' => 'DESC',
180 'holder' => 'dropdown',
181 'class' => 'order',
182 'value' =>array (
183 'DESC' => __('Descending', 'auxin-elements'),
184 'ASC' => __('Ascending', 'auxin-elements'),
185 ),
186 'admin_label' => true,
187 'dependency' => '',
188 'weight' => '',
189 'group' => '' ,
190 'edit_field_class' => ''
191 ),
192 array(
193 'heading' => __('Categories', 'auxin-elements'),
194 'description' => __('Specifies a category that you want to show posts from it.', 'auxin-elements' ),
195 'param_name' => 'cat',
196 'type' => 'dropdown',
197 'def_value' => 'default',
198 'holder' => 'dropdown',
199 'class' => 'cat',
200 'value' => $categories_list,
201 'admin_label' => true,
202 'dependency' => '',
203 'weight' => '',
204 'group' => '' ,
205 'edit_field_class' => ''
206 ),
207 // array(
208 // 'param_name' => 'tag',
209 // 'type' => 'dropdown',
210 // 'def_value' => '',
211 // 'holder' => '',
212 // 'class' => 'tag',
213 // 'heading' => __('Tags', 'auxin-elements'),
214 // 'description' => __('specify a tags that you want.', 'auxin-elements' ),
215 // 'value' => $tags_list,
216 // 'admin_label' => true,
217 // 'dependency' => '',
218 // 'weight' => '',
219 // 'group' => '' ,
220 // 'edit_field_class' => ''
221 // ),
222 array(
223 'heading' => __('Extra class name','auxin-elements' ),
224 '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' ),
225 'param_name' => 'extra_classes',
226 'type' => 'textfield',
227 'value' => '',
228 'def_value' => '',
229 'holder' => 'textfield',
230 'class' => 'extra_classes',
231 'admin_label' => true,
232 'dependency' => '',
233 'weight' => '',
234 'group' => '',
235 'edit_field_class' => ''
236 )
237 )
238 );
239
240 return $master_array;
241 }
242
243 add_filter( 'auxin_master_array_shortcodes', 'auxin_get_recent_post_widget_master_array', 10, 1 );
244
245
246
247
248 /**
249 * Element without loop and column
250 * The front-end output of this element is returned by the following function
251 *
252 * @param array $atts The array containing the parsed values from shortcode, it should be same as defined params above.
253 * @param string $shortcode_content The shorcode content
254 * @return string The output of element markup
255 */
256 function auxin_widget_recent_post_widget_callback( $atts, $shortcode_content = null ){
257
258 // Defining default attributes
259 $default_atts = array(
260 'title' => '', // header title
261 'num' => '4',
262 'show_media' => 1,
263 'show_excerpt' => 1,
264 'show_date' => 1,
265 'excerpt_len' => '60',
266 'order' => 'desc',
267 'order_by' => 'date',
268 'cat' => '',
269 'tag' => '',
270 'extra_classes' => '',
271 'custom_el_id' => '',
272 'base_class' => 'aux-widget-recent-post-widget'
273 );
274
275 // the parsed widget params
276 $result = auxin_get_widget_scafold( $atts, $default_atts, $shortcode_content );
277 $output = '';
278
279 // create wp_query to get latest items -----------
280 $recent_args = array(
281 'post_type' => 'post',
282 'orderby' => $result['parsed_atts']['order_by'],
283 'order' => $result['parsed_atts']['order'],
284 'post_status' => 'publish',
285 'posts_per_page' => $result['parsed_atts']['num'],
286 'cat' => $result['parsed_atts']['cat'],
287 // 'tag_id' => $tag,
288 'ignore_sticky_posts' => 1
289 );
290
291 // @TODO
292 $result['parsed_atts']['show_format'] = false;
293
294 // widget header ------------------------------
295
296 $output .= $result['widget_header'];
297 $output .= $result['widget_title'];
298
299 $output .= auxin_get_post_type_markup( $recent_args, 'templates/theme-parts/entry/widget-recent-post.php', $result['parsed_atts'] );
300
301 // widget footer ------------------------------
302 $output .= $result['widget_footer'];
303
304 return $output;
305 }
306