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