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