Version Description
Download this release
Release Info
Developer | idenovasi |
Plugin | Recent Posts Widget Extended |
Version | 1.1.0 |
Comparing to | |
See all releases |
Code changes from version 1.0.0 to 1.1.0
- assets/css/rpwe-admin.css +18 -48
- classes/widget.php +157 -163
- includes/form.php +279 -296
- includes/functions.php +384 -390
- includes/helpers.php +47 -53
- includes/resizer.php +207 -207
- includes/shortcode.php +20 -26
- languages/recent-posts-widget-extended-de_DE.mo +0 -0
- languages/recent-posts-widget-extended-de_DE.po +0 -0
- languages/recent-posts-widget-extended-fa_IR.mo +0 -0
- languages/recent-posts-widget-extended-fa_IR.po +0 -0
- languages/recent-posts-widget-extended-fr_FR.mo +0 -0
- languages/recent-posts-widget-extended-fr_FR.po +0 -0
- languages/recent-posts-widget-extended-pt_BR.mo +0 -0
- languages/recent-posts-widget-extended-pt_BR.po +0 -0
- languages/recent-posts-widget-extended.pot +44 -44
- readme.txt +252 -237
- rpwe.php +123 -136
- screenshot-1.png +0 -0
assets/css/rpwe-admin.css
CHANGED
@@ -1,48 +1,18 @@
|
|
1 |
-
.
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
}
|
20 |
-
|
21 |
-
.widgets-php .rpwe-columns-3 p small {
|
22 |
-
color: #777;
|
23 |
-
font-style: italic;
|
24 |
-
}
|
25 |
-
|
26 |
-
.small-input {
|
27 |
-
width: 30%;
|
28 |
-
}
|
29 |
-
|
30 |
-
.rpwe-block {
|
31 |
-
display: block;
|
32 |
-
}
|
33 |
-
|
34 |
-
.rpwe-multiple-check-form {
|
35 |
-
margin: 1em 0;
|
36 |
-
}
|
37 |
-
|
38 |
-
.rpwe-multiple-check-form ul {
|
39 |
-
border: 1px solid #eee;
|
40 |
-
padding: 10px;
|
41 |
-
max-height: 110px;
|
42 |
-
overflow: auto;
|
43 |
-
margin-top: 0;
|
44 |
-
}
|
45 |
-
|
46 |
-
.rpwe-multiple-check-form ul li:last-child {
|
47 |
-
margin-bottom: 0;
|
48 |
-
}
|
1 |
+
.rpwe-options small {
|
2 |
+
font-size: 0.7em;
|
3 |
+
color: #999;
|
4 |
+
}
|
5 |
+
|
6 |
+
.rpwe-info {
|
7 |
+
font-size: 0.8em;
|
8 |
+
line-height: 1.4;
|
9 |
+
}
|
10 |
+
|
11 |
+
.rpwe-options .small-input {
|
12 |
+
width: 32% !important;
|
13 |
+
display: inline-block !important;
|
14 |
+
}
|
15 |
+
|
16 |
+
.rpwe-block {
|
17 |
+
display: block;
|
18 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
classes/widget.php
CHANGED
@@ -1,163 +1,157 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* The custom recent posts widget.
|
5 |
-
* This widget gives total control over the output to the user.
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
$
|
24 |
-
'
|
25 |
-
'
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
'
|
31 |
-
'
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
$types
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
$instance
|
97 |
-
$instance['
|
98 |
-
$instance['
|
99 |
-
|
100 |
-
$instance['
|
101 |
-
$instance['
|
102 |
-
$instance['
|
103 |
-
$instance['
|
104 |
-
$instance['
|
105 |
-
|
106 |
-
$instance['
|
107 |
-
$instance['
|
108 |
-
$instance['
|
109 |
-
$instance['
|
110 |
-
$instance['
|
111 |
-
|
112 |
-
$instance['
|
113 |
-
$instance['
|
114 |
-
|
115 |
-
$instance['
|
116 |
-
$instance['
|
117 |
-
$instance['
|
118 |
-
$instance['
|
119 |
-
$instance['
|
120 |
-
|
121 |
-
$instance['
|
122 |
-
$instance['
|
123 |
-
$instance['
|
124 |
-
$instance['
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
if (current_user_can('unfiltered_html')) {
|
133 |
-
$instance['
|
134 |
-
} else {
|
135 |
-
$instance['
|
136 |
-
}
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
//
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
extract($instance);
|
159 |
-
|
160 |
-
// Loads the widget form.
|
161 |
-
include(RPWE_INCLUDES . 'form.php');
|
162 |
-
}
|
163 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* The custom recent posts widget.
|
5 |
+
* This widget gives total control over the output to the user.
|
6 |
+
*/
|
7 |
+
class Recent_Posts_Widget_Extended extends WP_Widget {
|
8 |
+
|
9 |
+
/**
|
10 |
+
* Sets up the widgets.
|
11 |
+
*
|
12 |
+
* @since 0.1
|
13 |
+
*/
|
14 |
+
public function __construct() {
|
15 |
+
|
16 |
+
/* Set up the widget options. */
|
17 |
+
$widget_options = array(
|
18 |
+
'classname' => 'rpwe_widget recent-posts-extended',
|
19 |
+
'description' => __('An advanced widget that gives you total control over the output of your site’s most recent Posts.', 'recent-posts-widget-extended'),
|
20 |
+
'customize_selective_refresh' => true
|
21 |
+
);
|
22 |
+
|
23 |
+
$control_options = array(
|
24 |
+
'width' => 750,
|
25 |
+
'height' => 350
|
26 |
+
);
|
27 |
+
|
28 |
+
/* Create the widget. */
|
29 |
+
parent::__construct(
|
30 |
+
'rpwe_widget', // $this->id_base
|
31 |
+
__('Recent Posts Extended', 'recent-posts-widget-extended'), // $this->name
|
32 |
+
$widget_options, // $this->widget_options
|
33 |
+
$control_options // $this->control_options
|
34 |
+
);
|
35 |
+
|
36 |
+
$this->alt_option_name = 'rpwe_widget';
|
37 |
+
}
|
38 |
+
|
39 |
+
/**
|
40 |
+
* Outputs the widget based on the arguments input through the widget controls.
|
41 |
+
*
|
42 |
+
* @since 0.1
|
43 |
+
*/
|
44 |
+
public function widget($args, $instance) {
|
45 |
+
extract($args);
|
46 |
+
|
47 |
+
$recent = rpwe_get_recent_posts($instance);
|
48 |
+
|
49 |
+
if ($recent) {
|
50 |
+
|
51 |
+
// Output the theme's $before_widget wrapper.
|
52 |
+
echo $before_widget;
|
53 |
+
|
54 |
+
// If both title and title url is not empty, display it.
|
55 |
+
if (!empty($instance['title_url']) && !empty($instance['title'])) {
|
56 |
+
echo $before_title . '<a href="' . esc_url($instance['title_url']) . '" title="' . esc_attr($instance['title']) . '">' . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . '</a>' . $after_title;
|
57 |
+
|
58 |
+
// If the title not empty, display it.
|
59 |
+
} elseif (!empty($instance['title'])) {
|
60 |
+
echo $before_title . apply_filters('widget_title', $instance['title'], $instance, $this->id_base) . $after_title;
|
61 |
+
}
|
62 |
+
|
63 |
+
// Get the recent posts query.
|
64 |
+
echo $recent;
|
65 |
+
|
66 |
+
// Close the theme's widget wrapper.
|
67 |
+
echo $after_widget;
|
68 |
+
}
|
69 |
+
}
|
70 |
+
|
71 |
+
/**
|
72 |
+
* Updates the widget control options for the particular instance of the widget.
|
73 |
+
*
|
74 |
+
* @since 0.1
|
75 |
+
*/
|
76 |
+
public function update($new_instance, $old_instance) {
|
77 |
+
|
78 |
+
// Validate post_type submissions
|
79 |
+
$name = get_post_types(array('public' => true), 'names');
|
80 |
+
$types = array();
|
81 |
+
foreach ($new_instance['post_type'] as $type) {
|
82 |
+
if (in_array($type, $name)) {
|
83 |
+
$types[] = $type;
|
84 |
+
}
|
85 |
+
}
|
86 |
+
if (empty($types)) {
|
87 |
+
$types[] = 'post';
|
88 |
+
}
|
89 |
+
|
90 |
+
$instance = $old_instance;
|
91 |
+
$instance['title'] = sanitize_text_field($new_instance['title']);
|
92 |
+
$instance['title_url'] = esc_url_raw($new_instance['title_url']);
|
93 |
+
|
94 |
+
$instance['ignore_sticky'] = isset($new_instance['ignore_sticky']) ? (bool) $new_instance['ignore_sticky'] : 0;
|
95 |
+
$instance['exclude_current'] = isset($new_instance['exclude_current']) ? (bool) $new_instance['exclude_current'] : 0;
|
96 |
+
$instance['limit'] = intval($new_instance['limit']);
|
97 |
+
$instance['offset'] = intval($new_instance['offset']);
|
98 |
+
$instance['order'] = stripslashes($new_instance['order']);
|
99 |
+
$instance['orderby'] = stripslashes($new_instance['orderby']);
|
100 |
+
$instance['post_type'] = $types;
|
101 |
+
$instance['post_status'] = stripslashes($new_instance['post_status']);
|
102 |
+
$instance['cat'] = $new_instance['cat'];
|
103 |
+
$instance['tag'] = $new_instance['tag'];
|
104 |
+
$instance['taxonomy'] = esc_attr($new_instance['taxonomy']);
|
105 |
+
|
106 |
+
$instance['excerpt'] = isset($new_instance['excerpt']) ? (bool) $new_instance['excerpt'] : false;
|
107 |
+
$instance['length'] = intval($new_instance['length']);
|
108 |
+
$instance['date'] = isset($new_instance['date']) ? (bool) $new_instance['date'] : false;
|
109 |
+
$instance['date_relative'] = isset($new_instance['date_relative']) ? (bool) $new_instance['date_relative'] : false;
|
110 |
+
$instance['date_modified'] = isset($new_instance['date_modified']) ? (bool) $new_instance['date_modified'] : false;
|
111 |
+
$instance['readmore'] = isset($new_instance['readmore']) ? (bool) $new_instance['readmore'] : false;
|
112 |
+
$instance['readmore_text'] = sanitize_text_field($new_instance['readmore_text']);
|
113 |
+
$instance['comment_count'] = isset($new_instance['comment_count']) ? (bool) $new_instance['comment_count'] : false;
|
114 |
+
|
115 |
+
$instance['thumb'] = isset($new_instance['thumb']) ? (bool) $new_instance['thumb'] : false;
|
116 |
+
$instance['thumb_height'] = intval($new_instance['thumb_height']);
|
117 |
+
$instance['thumb_width'] = intval($new_instance['thumb_width']);
|
118 |
+
$instance['thumb_default'] = esc_url_raw($new_instance['thumb_default']);
|
119 |
+
$instance['thumb_align'] = esc_attr($new_instance['thumb_align']);
|
120 |
+
|
121 |
+
$instance['styles_default'] = isset($new_instance['styles_default']) ? (bool) $new_instance['styles_default'] : false;
|
122 |
+
$instance['cssID'] = sanitize_html_class($new_instance['cssID']);
|
123 |
+
$instance['css_class'] = sanitize_html_class($new_instance['css_class']);
|
124 |
+
$instance['css'] = $new_instance['css'];
|
125 |
+
|
126 |
+
if (current_user_can('unfiltered_html')) {
|
127 |
+
$instance['before'] = $new_instance['before'];
|
128 |
+
} else {
|
129 |
+
$instance['before'] = wp_kses_post($new_instance['before']);
|
130 |
+
}
|
131 |
+
|
132 |
+
if (current_user_can('unfiltered_html')) {
|
133 |
+
$instance['after'] = $new_instance['after'];
|
134 |
+
} else {
|
135 |
+
$instance['after'] = wp_kses_post($new_instance['after']);
|
136 |
+
}
|
137 |
+
|
138 |
+
return $instance;
|
139 |
+
}
|
140 |
+
|
141 |
+
/**
|
142 |
+
* Displays the widget control options in the Widgets admin screen.
|
143 |
+
*
|
144 |
+
* @since 0.1
|
145 |
+
*/
|
146 |
+
public function form($instance) {
|
147 |
+
|
148 |
+
// Merge the user-selected arguments with the defaults.
|
149 |
+
$instance = wp_parse_args((array) $instance, rpwe_get_default_args());
|
150 |
+
|
151 |
+
// Extract the array to allow easy use of variables.
|
152 |
+
extract($instance);
|
153 |
+
|
154 |
+
// Loads the widget form.
|
155 |
+
include(RPWE_INCLUDES . 'form.php');
|
156 |
+
}
|
157 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
includes/form.php
CHANGED
@@ -1,296 +1,279 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Widget forms.
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
?>
|
13 |
-
|
14 |
-
<
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
<
|
56 |
-
|
57 |
-
|
58 |
-
</
|
59 |
-
|
60 |
-
<
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
<?php
|
89 |
-
</
|
90 |
-
</
|
91 |
-
|
92 |
-
<p>
|
93 |
-
<label for="<?php echo $this->get_field_id('
|
94 |
-
<?php _e('
|
95 |
-
</label>
|
96 |
-
<select class="widefat" id="<?php echo $this->get_field_id('
|
97 |
-
<?php
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
<option value="
|
109 |
-
<option value="
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
<
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
<
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
<
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
<
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
<label for="<?php echo $this->get_field_id('
|
245 |
-
<?php _e('
|
246 |
-
</label>
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
<
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
<
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
<p>
|
265 |
-
<input id="<?php echo $this->get_field_id('
|
266 |
-
<label for="<?php echo $this->get_field_id('
|
267 |
-
<?php _e('
|
268 |
-
</label>
|
269 |
-
</p>
|
270 |
-
|
271 |
-
<p>
|
272 |
-
<
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
</div>
|
280 |
-
|
281 |
-
<div class="clear"></div>
|
282 |
-
|
283 |
-
<p>
|
284 |
-
<input id="<?php echo $this->get_field_id('styles_default'); ?>" name="<?php echo $this->get_field_name('styles_default'); ?>" type="checkbox" <?php checked($instance['styles_default']); ?> />
|
285 |
-
<label for="<?php echo $this->get_field_id('styles_default'); ?>">
|
286 |
-
<?php _e('Use Default Styles', 'recent-posts-widget-extended'); ?>
|
287 |
-
</label>
|
288 |
-
</p>
|
289 |
-
|
290 |
-
<p>
|
291 |
-
<label for="<?php echo $this->get_field_id('css'); ?>">
|
292 |
-
<?php _e('Custom CSS', 'recent-posts-widget-extended'); ?>
|
293 |
-
</label>
|
294 |
-
<textarea class="widefat" id="<?php echo $this->get_field_id('css'); ?>" name="<?php echo $this->get_field_name('css'); ?>" style="height:180px;"><?php echo $instance['css']; ?></textarea>
|
295 |
-
<small><?php _e('If you turn off the default styles, you can use these css code to customize the recent posts style.', 'recent-posts-widget-extended'); ?></small>
|
296 |
-
</p>
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Widget forms.
|
5 |
+
*/
|
6 |
+
?>
|
7 |
+
|
8 |
+
<div class="rpwe-options">
|
9 |
+
|
10 |
+
<p>
|
11 |
+
<label for="<?php echo $this->get_field_id('title'); ?>">
|
12 |
+
<?php _e('Title', 'recent-posts-widget-extended'); ?>
|
13 |
+
</label>
|
14 |
+
<input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($instance['title']); ?>" />
|
15 |
+
</p>
|
16 |
+
|
17 |
+
<p>
|
18 |
+
<label for="<?php echo $this->get_field_id('title_url'); ?>">
|
19 |
+
<?php _e('Title URL', 'recent-posts-widget-extended'); ?>
|
20 |
+
</label>
|
21 |
+
<input class="widefat" id="<?php echo $this->get_field_id('title_url'); ?>" name="<?php echo $this->get_field_name('title_url'); ?>" type="text" value="<?php echo esc_url($instance['title_url']); ?>" />
|
22 |
+
</p>
|
23 |
+
|
24 |
+
<p>
|
25 |
+
<label for="<?php echo $this->get_field_id('cssID'); ?>">
|
26 |
+
<?php _e('CSS ID', 'recent-posts-widget-extended'); ?>
|
27 |
+
</label>
|
28 |
+
<input class="widefat" id="<?php echo $this->get_field_id('cssID'); ?>" name="<?php echo $this->get_field_name('cssID'); ?>" type="text" value="<?php echo sanitize_html_class($instance['cssID']); ?>" />
|
29 |
+
</p>
|
30 |
+
|
31 |
+
<p>
|
32 |
+
<label for="<?php echo $this->get_field_id('css_class'); ?>">
|
33 |
+
<?php _e('CSS Class', 'recent-posts-widget-extended'); ?>
|
34 |
+
</label>
|
35 |
+
<input class="widefat" id="<?php echo $this->get_field_id('css_class'); ?>" name="<?php echo $this->get_field_name('css_class'); ?>" type="text" value="<?php echo sanitize_html_class($instance['css_class']); ?>" />
|
36 |
+
</p>
|
37 |
+
|
38 |
+
<p>
|
39 |
+
<label for="<?php echo $this->get_field_id('before'); ?>">
|
40 |
+
<?php _e('HTML or text before the recent posts', 'recent-posts-widget-extended'); ?>
|
41 |
+
</label>
|
42 |
+
<textarea class="widefat" id="<?php echo $this->get_field_id('before'); ?>" name="<?php echo $this->get_field_name('before'); ?>" rows="5"><?php echo htmlspecialchars(stripslashes($instance['before'])); ?></textarea>
|
43 |
+
</p>
|
44 |
+
|
45 |
+
<p>
|
46 |
+
<label for="<?php echo $this->get_field_id('after'); ?>">
|
47 |
+
<?php _e('HTML or text after the recent posts', 'recent-posts-widget-extended'); ?>
|
48 |
+
</label>
|
49 |
+
<textarea class="widefat" id="<?php echo $this->get_field_id('after'); ?>" name="<?php echo $this->get_field_name('after'); ?>" rows="5"><?php echo htmlspecialchars(stripslashes($instance['after'])); ?></textarea>
|
50 |
+
</p>
|
51 |
+
|
52 |
+
|
53 |
+
<p>
|
54 |
+
<input class="checkbox" type="checkbox" <?php checked($instance['ignore_sticky'], 1); ?> id="<?php echo $this->get_field_id('ignore_sticky'); ?>" name="<?php echo $this->get_field_name('ignore_sticky'); ?>" />
|
55 |
+
<label for="<?php echo $this->get_field_id('ignore_sticky'); ?>">
|
56 |
+
<?php _e('Ignore sticky posts', 'recent-posts-widget-extended'); ?>
|
57 |
+
</label>
|
58 |
+
</p>
|
59 |
+
|
60 |
+
<p>
|
61 |
+
<input class="checkbox" type="checkbox" <?php checked($instance['exclude_current'], 1); ?> id="<?php echo $this->get_field_id('exclude_current'); ?>" name="<?php echo $this->get_field_name('exclude_current'); ?>" />
|
62 |
+
<label for="<?php echo $this->get_field_id('exclude_current'); ?>">
|
63 |
+
<?php _e('Exclude current post', 'recent-posts-widget-extended'); ?>
|
64 |
+
</label>
|
65 |
+
</p>
|
66 |
+
|
67 |
+
<div class="rpwe-multiple-check-form">
|
68 |
+
<label>
|
69 |
+
<?php _e('Post Types', 'recent-posts-widget-extended'); ?>
|
70 |
+
</label>
|
71 |
+
<?php foreach (get_post_types(array('public' => true), 'objects') as $type) : ?>
|
72 |
+
<p>
|
73 |
+
<input type="checkbox" value="<?php echo esc_attr($type->name); ?>" id="<?php echo $this->get_field_id('post_type') . '-' . $type->name; ?>" name="<?php echo $this->get_field_name('post_type'); ?>[]" <?php checked(is_array($instance['post_type']) && in_array($type->name, $instance['post_type'])); ?> />
|
74 |
+
<label for="<?php echo $this->get_field_id('post_type') . '-' . $type->name; ?>">
|
75 |
+
<?php echo esc_html($type->labels->name); ?>
|
76 |
+
</label>
|
77 |
+
</p>
|
78 |
+
<?php endforeach; ?>
|
79 |
+
</div>
|
80 |
+
|
81 |
+
<p>
|
82 |
+
<label for="<?php echo $this->get_field_id('post_status'); ?>">
|
83 |
+
<?php _e('Post Status', 'recent-posts-widget-extended'); ?>
|
84 |
+
</label>
|
85 |
+
<select class="widefat" id="<?php echo $this->get_field_id('post_status'); ?>" name="<?php echo $this->get_field_name('post_status'); ?>" style="width:100%;">
|
86 |
+
<?php foreach (array_keys(get_object_vars(wp_count_posts('post'))) as $status_value => $status_label) { ?>
|
87 |
+
<option value="<?php echo esc_attr($status_label); ?>" <?php selected($instance['post_status'], $status_label); ?>><?php echo esc_html(ucfirst($status_label)); ?></option>
|
88 |
+
<?php } ?>
|
89 |
+
</select>
|
90 |
+
</p>
|
91 |
+
|
92 |
+
<p>
|
93 |
+
<label for="<?php echo $this->get_field_id('order'); ?>">
|
94 |
+
<?php _e('Order', 'recent-posts-widget-extended'); ?>
|
95 |
+
</label>
|
96 |
+
<select class="widefat" id="<?php echo $this->get_field_id('order'); ?>" name="<?php echo $this->get_field_name('order'); ?>" style="width:100%;">
|
97 |
+
<option value="DESC" <?php selected($instance['order'], 'DESC'); ?>><?php _e('Descending', 'rpwe') ?></option>
|
98 |
+
<option value="ASC" <?php selected($instance['order'], 'ASC'); ?>><?php _e('Ascending', 'rpwe') ?></option>
|
99 |
+
</select>
|
100 |
+
</p>
|
101 |
+
|
102 |
+
<p>
|
103 |
+
<label for="<?php echo $this->get_field_id('orderby'); ?>">
|
104 |
+
<?php _e('Orderby', 'recent-posts-widget-extended'); ?>
|
105 |
+
</label>
|
106 |
+
<select class="widefat" id="<?php echo $this->get_field_id('orderby'); ?>" name="<?php echo $this->get_field_name('orderby'); ?>" style="width:100%;">
|
107 |
+
<option value="ID" <?php selected($instance['orderby'], 'ID'); ?>><?php _e('ID', 'rpwe') ?></option>
|
108 |
+
<option value="author" <?php selected($instance['orderby'], 'author'); ?>><?php _e('Author', 'rpwe') ?></option>
|
109 |
+
<option value="title" <?php selected($instance['orderby'], 'title'); ?>><?php _e('Title', 'rpwe') ?></option>
|
110 |
+
<option value="date" <?php selected($instance['orderby'], 'date'); ?>><?php _e('Date', 'rpwe') ?></option>
|
111 |
+
<option value="modified" <?php selected($instance['orderby'], 'modified'); ?>><?php _e('Modified', 'rpwe') ?></option>
|
112 |
+
<option value="rand" <?php selected($instance['orderby'], 'rand'); ?>><?php _e('Random', 'rpwe') ?></option>
|
113 |
+
<option value="comment_count" <?php selected($instance['orderby'], 'comment_count'); ?>><?php _e('Comment Count', 'rpwe') ?></option>
|
114 |
+
<option value="menu_order" <?php selected($instance['orderby'], 'menu_order'); ?>><?php _e('Menu Order', 'rpwe') ?></option>
|
115 |
+
</select>
|
116 |
+
</p>
|
117 |
+
|
118 |
+
<div class="rpwe-multiple-check-form">
|
119 |
+
<label>
|
120 |
+
<?php _e('Limit to Category', 'recent-posts-widget-extended'); ?>
|
121 |
+
</label>
|
122 |
+
|
123 |
+
<?php foreach (rpwe_cats_list() as $category) : ?>
|
124 |
+
<p>
|
125 |
+
<input type="checkbox" value="<?php echo (int) $category->term_id; ?>" id="<?php echo $this->get_field_id('cat') . '-' . (int) $category->term_id; ?>" name="<?php echo $this->get_field_name('cat'); ?>[]" <?php checked(is_array($instance['cat']) && in_array($category->term_id, $instance['cat'])); ?> />
|
126 |
+
<label for="<?php echo $this->get_field_id('cat') . '-' . (int) $category->term_id; ?>">
|
127 |
+
<?php echo esc_html($category->name); ?>
|
128 |
+
</label>
|
129 |
+
</p>
|
130 |
+
<?php endforeach; ?>
|
131 |
+
</div>
|
132 |
+
|
133 |
+
<div class="rpwe-multiple-check-form">
|
134 |
+
<label>
|
135 |
+
<?php _e('Limit to Tag', 'recent-posts-widget-extended'); ?>
|
136 |
+
</label>
|
137 |
+
<?php foreach (rpwe_tags_list() as $post_tag) : ?>
|
138 |
+
<p>
|
139 |
+
<input type="checkbox" value="<?php echo (int) $post_tag->term_id; ?>" id="<?php echo $this->get_field_id('tag') . '-' . (int) $post_tag->term_id; ?>" name="<?php echo $this->get_field_name('tag'); ?>[]" <?php checked(is_array($instance['tag']) && in_array($post_tag->term_id, $instance['tag'])); ?> />
|
140 |
+
<label for="<?php echo $this->get_field_id('tag') . '-' . (int) $post_tag->term_id; ?>">
|
141 |
+
<?php echo esc_html($post_tag->name); ?>
|
142 |
+
</label>
|
143 |
+
</p>
|
144 |
+
<?php endforeach; ?>
|
145 |
+
</div>
|
146 |
+
|
147 |
+
<p>
|
148 |
+
<label for="<?php echo $this->get_field_id('taxonomy'); ?>">
|
149 |
+
<?php _e('Limit to Taxonomy', 'recent-posts-widget-extended'); ?>
|
150 |
+
</label>
|
151 |
+
<input type="text" class="widefat" id="<?php echo $this->get_field_id('taxonomy'); ?>" name="<?php echo $this->get_field_name('taxonomy'); ?>" value="<?php echo esc_attr($instance['taxonomy']); ?>" />
|
152 |
+
<small><?php _e('Ex: category=1,2,4&post_tag=6,12. ', 'rpwe'); ?>
|
153 |
+
<?php _e('Available: ', 'rpwe');
|
154 |
+
echo implode(', ', get_taxonomies(array('public' => true))); ?></small>
|
155 |
+
</p>
|
156 |
+
|
157 |
+
<p>
|
158 |
+
<label for="<?php echo $this->get_field_id('limit'); ?>">
|
159 |
+
<?php _e('Number of posts to show', 'recent-posts-widget-extended'); ?>
|
160 |
+
</label>
|
161 |
+
<input class="widefat" id="<?php echo $this->get_field_id('limit'); ?>" name="<?php echo $this->get_field_name('limit'); ?>" type="number" step="1" min="-1" value="<?php echo (int)($instance['limit']); ?>" />
|
162 |
+
</p>
|
163 |
+
|
164 |
+
<p>
|
165 |
+
<label for="<?php echo $this->get_field_id('offset'); ?>">
|
166 |
+
<?php _e('Offset', 'recent-posts-widget-extended'); ?>
|
167 |
+
</label>
|
168 |
+
<input class="widefat" id="<?php echo $this->get_field_id('offset'); ?>" name="<?php echo $this->get_field_name('offset'); ?>" type="number" step="1" min="0" value="<?php echo (int)($instance['offset']); ?>" />
|
169 |
+
<small><?php _e('The number of posts to skip', 'recent-posts-widget-extended'); ?></small>
|
170 |
+
</p>
|
171 |
+
|
172 |
+
<?php if (current_theme_supports('post-thumbnails')) { ?>
|
173 |
+
|
174 |
+
<p>
|
175 |
+
<input id="<?php echo $this->get_field_id('thumb'); ?>" name="<?php echo $this->get_field_name('thumb'); ?>" type="checkbox" <?php checked($instance['thumb']); ?> />
|
176 |
+
<label for="<?php echo $this->get_field_id('thumb'); ?>">
|
177 |
+
<?php _e('Display Thumbnail', 'recent-posts-widget-extended'); ?>
|
178 |
+
</label>
|
179 |
+
</p>
|
180 |
+
|
181 |
+
<p>
|
182 |
+
<label class="rpwe-block" for="<?php echo $this->get_field_id('thumb_height'); ?>">
|
183 |
+
<?php _e('Thumbnail (height,width,align)', 'recent-posts-widget-extended'); ?>
|
184 |
+
</label>
|
185 |
+
|
186 |
+
<input class="small-input" id="<?php echo $this->get_field_id('thumb_height'); ?>" name="<?php echo $this->get_field_name('thumb_height'); ?>" type="number" step="1" min="0" value="<?php echo (int)($instance['thumb_height']); ?>" />
|
187 |
+
|
188 |
+
<input class="small-input" id="<?php echo $this->get_field_id('thumb_width'); ?>" name="<?php echo $this->get_field_name('thumb_width'); ?>" type="number" step="1" min="0" value="<?php echo (int)($instance['thumb_width']); ?>" />
|
189 |
+
|
190 |
+
<select class="small-input" id="<?php echo $this->get_field_id('thumb_align'); ?>" name="<?php echo $this->get_field_name('thumb_align'); ?>">
|
191 |
+
<option value="rpwe-alignleft" <?php selected($instance['thumb_align'], 'rpwe-alignleft'); ?>><?php _e('Left', 'recent-posts-widget-extended') ?></option>
|
192 |
+
<option value="rpwe-alignright" <?php selected($instance['thumb_align'], 'rpwe-alignright'); ?>><?php _e('Right', 'recent-posts-widget-extended') ?></option>
|
193 |
+
<option value="rpwe-aligncenter" <?php selected($instance['thumb_align'], 'rpwe-aligncenter'); ?>><?php _e('Center', 'recent-posts-widget-extended') ?></option>
|
194 |
+
</select>
|
195 |
+
</p>
|
196 |
+
|
197 |
+
<p>
|
198 |
+
<label for="<?php echo $this->get_field_id('thumb_default'); ?>">
|
199 |
+
<?php _e('Default Thumbnail', 'recent-posts-widget-extended'); ?>
|
200 |
+
</label>
|
201 |
+
<input class="widefat" id="<?php echo $this->get_field_id('thumb_default'); ?>" name="<?php echo $this->get_field_name('thumb_default'); ?>" type="text" value="<?php echo $instance['thumb_default']; ?>" />
|
202 |
+
<small><?php _e('Leave it blank to disable.', 'recent-posts-widget-extended'); ?></small>
|
203 |
+
</p>
|
204 |
+
|
205 |
+
<?php } ?>
|
206 |
+
|
207 |
+
<p>
|
208 |
+
<input id="<?php echo $this->get_field_id('excerpt'); ?>" name="<?php echo $this->get_field_name('excerpt'); ?>" type="checkbox" <?php checked($instance['excerpt']); ?> />
|
209 |
+
<label for="<?php echo $this->get_field_id('excerpt'); ?>">
|
210 |
+
<?php _e('Display Excerpt', 'recent-posts-widget-extended'); ?>
|
211 |
+
</label>
|
212 |
+
</p>
|
213 |
+
|
214 |
+
<p>
|
215 |
+
<label for="<?php echo $this->get_field_id('length'); ?>">
|
216 |
+
<?php _e('Excerpt Length', 'recent-posts-widget-extended'); ?>
|
217 |
+
</label>
|
218 |
+
<input class="widefat" id="<?php echo $this->get_field_id('length'); ?>" name="<?php echo $this->get_field_name('length'); ?>" type="number" step="1" min="0" value="<?php echo (int)($instance['length']); ?>" />
|
219 |
+
</p>
|
220 |
+
|
221 |
+
<p>
|
222 |
+
<input id="<?php echo $this->get_field_id('readmore'); ?>" name="<?php echo $this->get_field_name('readmore'); ?>" type="checkbox" <?php checked($instance['readmore']); ?> />
|
223 |
+
<label for="<?php echo $this->get_field_id('readmore'); ?>">
|
224 |
+
<?php _e('Display Readmore', 'recent-posts-widget-extended'); ?>
|
225 |
+
</label>
|
226 |
+
</p>
|
227 |
+
|
228 |
+
<p>
|
229 |
+
<label for="<?php echo $this->get_field_id('readmore_text'); ?>">
|
230 |
+
<?php _e('Readmore Text', 'recent-posts-widget-extended'); ?>
|
231 |
+
</label>
|
232 |
+
<input class="widefat" id="<?php echo $this->get_field_id('readmore_text'); ?>" name="<?php echo $this->get_field_name('readmore_text'); ?>" type="text" value="<?php echo strip_tags($instance['readmore_text']); ?>" />
|
233 |
+
</p>
|
234 |
+
|
235 |
+
<p>
|
236 |
+
<input id="<?php echo $this->get_field_id('comment_count'); ?>" name="<?php echo $this->get_field_name('comment_count'); ?>" type="checkbox" <?php checked($instance['comment_count']); ?> />
|
237 |
+
<label for="<?php echo $this->get_field_id('comment_count'); ?>">
|
238 |
+
<?php _e('Display Comment Count', 'recent-posts-widget-extended'); ?>
|
239 |
+
</label>
|
240 |
+
</p>
|
241 |
+
|
242 |
+
<p>
|
243 |
+
<input id="<?php echo $this->get_field_id('date'); ?>" name="<?php echo $this->get_field_name('date'); ?>" type="checkbox" <?php checked($instance['date']); ?> />
|
244 |
+
<label for="<?php echo $this->get_field_id('date'); ?>">
|
245 |
+
<?php _e('Display Date', 'recent-posts-widget-extended'); ?>
|
246 |
+
</label>
|
247 |
+
</p>
|
248 |
+
|
249 |
+
<p>
|
250 |
+
<input id="<?php echo $this->get_field_id('date_modified'); ?>" name="<?php echo $this->get_field_name('date_modified'); ?>" type="checkbox" <?php checked($instance['date_modified']); ?> />
|
251 |
+
<label for="<?php echo $this->get_field_id('date_modified'); ?>">
|
252 |
+
<?php _e('Display Modification Date', 'recent-posts-widget-extended'); ?>
|
253 |
+
</label>
|
254 |
+
</p>
|
255 |
+
|
256 |
+
<p>
|
257 |
+
<input id="<?php echo $this->get_field_id('date_relative'); ?>" name="<?php echo $this->get_field_name('date_relative'); ?>" type="checkbox" <?php checked($instance['date_relative']); ?> />
|
258 |
+
<label for="<?php echo $this->get_field_id('date_relative'); ?>">
|
259 |
+
<?php _e('Use Relative Date. eg: 5 days ago', 'recent-posts-widget-extended'); ?>
|
260 |
+
</label>
|
261 |
+
</p>
|
262 |
+
|
263 |
+
|
264 |
+
<p>
|
265 |
+
<input id="<?php echo $this->get_field_id('styles_default'); ?>" name="<?php echo $this->get_field_name('styles_default'); ?>" type="checkbox" <?php checked($instance['styles_default']); ?> />
|
266 |
+
<label for="<?php echo $this->get_field_id('styles_default'); ?>">
|
267 |
+
<?php _e('Use Default Styles', 'recent-posts-widget-extended'); ?>
|
268 |
+
</label>
|
269 |
+
</p>
|
270 |
+
|
271 |
+
<p>
|
272 |
+
<label for="<?php echo $this->get_field_id('css'); ?>">
|
273 |
+
<?php _e('Custom CSS', 'recent-posts-widget-extended'); ?>
|
274 |
+
</label>
|
275 |
+
<textarea class="widefat" id="<?php echo $this->get_field_id('css'); ?>" name="<?php echo $this->get_field_name('css'); ?>" style="height:180px;"><?php echo $instance['css']; ?></textarea>
|
276 |
+
<small><?php _e('If you turn off the default styles, you can use these css code to customize the recent posts style.', 'recent-posts-widget-extended'); ?></small>
|
277 |
+
</p>
|
278 |
+
|
279 |
+
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/functions.php
CHANGED
@@ -1,390 +1,384 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Various functions used by the plugin.
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
*
|
9 |
-
*
|
10 |
-
* @
|
11 |
-
*/
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
178 |
-
|
179 |
-
|
180 |
-
|
181 |
-
|
182 |
-
|
183 |
-
|
184 |
-
|
185 |
-
|
186 |
-
|
187 |
-
|
188 |
-
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
|
198 |
-
|
199 |
-
|
200 |
-
|
201 |
-
|
202 |
-
|
203 |
-
|
204 |
-
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
|
209 |
-
|
210 |
-
|
211 |
-
|
212 |
-
|
213 |
-
|
214 |
-
|
215 |
-
|
216 |
-
|
217 |
-
|
218 |
-
|
219 |
-
|
220 |
-
|
221 |
-
|
222 |
-
|
223 |
-
|
224 |
-
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
239 |
-
|
240 |
-
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
245 |
-
|
246 |
-
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
251 |
-
|
252 |
-
|
253 |
-
|
254 |
-
|
255 |
-
|
256 |
-
|
257 |
-
|
258 |
-
|
259 |
-
|
260 |
-
|
261 |
-
|
262 |
-
|
263 |
-
|
264 |
-
|
265 |
-
|
266 |
-
|
267 |
-
|
268 |
-
|
269 |
-
|
270 |
-
|
271 |
-
|
272 |
-
|
273 |
-
|
274 |
-
|
275 |
-
|
276 |
-
|
277 |
-
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
296 |
-
|
297 |
-
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
|
308 |
-
|
309 |
-
|
310 |
-
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
-
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
.rpwe-clearfix {
|
386 |
-
zoom: 1;
|
387 |
-
}
|
388 |
-
</style>
|
389 |
-
<?php
|
390 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Various functions used by the plugin.
|
5 |
+
*/
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Sets up the default arguments.
|
9 |
+
*
|
10 |
+
* @since 0.9.4
|
11 |
+
*/
|
12 |
+
function rpwe_get_default_args() {
|
13 |
+
|
14 |
+
$css_defaults = ".rpwe-block ul{\nlist-style: none !important;\nmargin-left: 0 !important;\npadding-left: 0 !important;\n}\n\n.rpwe-block li{\nborder-bottom: 1px solid #eee;\nmargin-bottom: 10px;\npadding-bottom: 10px;\nlist-style-type: none;\n}\n\n.rpwe-block a{\ndisplay: inline !important;\ntext-decoration: none;\n}\n\n.rpwe-block h3{\nbackground: none !important;\nclear: none;\nmargin-bottom: 0 !important;\nmargin-top: 0 !important;\nfont-weight: 400;\nfont-size: 12px !important;\nline-height: 1.5em;\n}\n\n.rpwe-thumb{\nborder: 1px solid #eee !important;\nbox-shadow: none !important;\nmargin: 2px 10px 2px 0;\npadding: 3px !important;\n}\n\n.rpwe-summary{\nfont-size: 12px;\n}\n\n.rpwe-time{\ncolor: #bbb;\nfont-size: 11px;\n}\n\n.rpwe-comment{\ncolor: #bbb;\nfont-size: 11px;\npadding-left: 5px;\n}\n\n.rpwe-alignleft{\ndisplay: inline;\nfloat: left;\n}\n\n.rpwe-alignright{\ndisplay: inline;\nfloat: right;\n}\n\n.rpwe-aligncenter{\ndisplay: block;\nmargin-left: auto;\nmargin-right: auto;\n}\n\n.rpwe-clearfix:before,\n.rpwe-clearfix:after{\ncontent: \"\";\ndisplay: table !important;\n}\n\n.rpwe-clearfix:after{\nclear: both;\n}\n\n.rpwe-clearfix{\nzoom: 1;\n}\n";
|
15 |
+
|
16 |
+
$defaults = array(
|
17 |
+
'title' => esc_attr__('Recent Posts', 'rpwe'),
|
18 |
+
'title_url' => '',
|
19 |
+
|
20 |
+
'limit' => 5,
|
21 |
+
'offset' => 0,
|
22 |
+
'order' => 'DESC',
|
23 |
+
'orderby' => 'date',
|
24 |
+
'cat' => array(),
|
25 |
+
'tag' => array(),
|
26 |
+
'taxonomy' => '',
|
27 |
+
'post_type' => array('post'),
|
28 |
+
'post_status' => 'publish',
|
29 |
+
'ignore_sticky' => 1,
|
30 |
+
'exclude_current' => 1,
|
31 |
+
|
32 |
+
'excerpt' => false,
|
33 |
+
'length' => 10,
|
34 |
+
'thumb' => true,
|
35 |
+
'thumb_height' => 45,
|
36 |
+
'thumb_width' => 45,
|
37 |
+
'thumb_default' => 'http://placehold.it/45x45/f0f0f0/ccc',
|
38 |
+
'thumb_align' => 'rpwe-alignleft',
|
39 |
+
'date' => true,
|
40 |
+
'date_relative' => false,
|
41 |
+
'date_modified' => false,
|
42 |
+
'readmore' => false,
|
43 |
+
'readmore_text' => __('Read More »', 'recent-posts-widget-extended'),
|
44 |
+
'comment_count' => false,
|
45 |
+
|
46 |
+
'styles_default' => true,
|
47 |
+
'css' => $css_defaults,
|
48 |
+
'cssID' => '',
|
49 |
+
'css_class' => '',
|
50 |
+
'before' => '',
|
51 |
+
'after' => ''
|
52 |
+
);
|
53 |
+
|
54 |
+
// Allow plugins/themes developer to filter the default arguments.
|
55 |
+
return apply_filters('rpwe_default_args', $defaults);
|
56 |
+
}
|
57 |
+
|
58 |
+
/**
|
59 |
+
* Outputs the recent posts.
|
60 |
+
*
|
61 |
+
* @since 0.9.4
|
62 |
+
*/
|
63 |
+
function rpwe_recent_posts($args = array()) {
|
64 |
+
echo rpwe_get_recent_posts($args);
|
65 |
+
}
|
66 |
+
|
67 |
+
/**
|
68 |
+
* Generates the posts markup.
|
69 |
+
*
|
70 |
+
* @since 0.9.4
|
71 |
+
* @param array $args
|
72 |
+
* @return string|array The HTML for the random posts.
|
73 |
+
*/
|
74 |
+
function rpwe_get_recent_posts($args = array()) {
|
75 |
+
|
76 |
+
// Set up a default, empty variable.
|
77 |
+
$html = '';
|
78 |
+
|
79 |
+
// Merge the input arguments and the defaults.
|
80 |
+
$args = wp_parse_args($args, rpwe_get_default_args());
|
81 |
+
|
82 |
+
// Extract the array to allow easy use of variables.
|
83 |
+
extract($args);
|
84 |
+
|
85 |
+
// Allow devs to hook in stuff before the loop.
|
86 |
+
do_action('rpwe_before_loop');
|
87 |
+
|
88 |
+
// Display the default style of the plugin.
|
89 |
+
if ($args['styles_default'] === true) {
|
90 |
+
rpwe_custom_styles();
|
91 |
+
}
|
92 |
+
|
93 |
+
// If the default style is disabled then use the custom css if it's not empty.
|
94 |
+
if ($args['styles_default'] === false && !empty($args['css'])) {
|
95 |
+
echo '<style>' . $args['css'] . '</style>';
|
96 |
+
}
|
97 |
+
|
98 |
+
// Get the posts query.
|
99 |
+
$posts = rpwe_get_posts($args);
|
100 |
+
|
101 |
+
if ($posts->have_posts()) :
|
102 |
+
|
103 |
+
// Recent posts wrapper
|
104 |
+
$html = '<div ' . (!empty($args['cssID']) ? 'id="' . sanitize_html_class($args['cssID']) . '"' : '') . ' class="rpwe-block ' . (!empty($args['css_class']) ? '' . sanitize_html_class($args['css_class']) . '' : '') . '">';
|
105 |
+
|
106 |
+
$html .= '<ul class="rpwe-ul">';
|
107 |
+
|
108 |
+
while ($posts->have_posts()) : $posts->the_post();
|
109 |
+
|
110 |
+
// Thumbnails
|
111 |
+
$thumb_id = get_post_thumbnail_id(); // Get the featured image id.
|
112 |
+
$img_url = wp_get_attachment_url($thumb_id); // Get img URL.
|
113 |
+
|
114 |
+
// Display the image url and crop using the resizer.
|
115 |
+
$image = rpwe_resize($img_url, $args['thumb_width'], $args['thumb_height'], true);
|
116 |
+
|
117 |
+
// Start recent posts markup.
|
118 |
+
$html .= '<li class="rpwe-li rpwe-clearfix">';
|
119 |
+
|
120 |
+
if ($args['thumb']) :
|
121 |
+
|
122 |
+
// Check if post has post thumbnail.
|
123 |
+
if (has_post_thumbnail()) :
|
124 |
+
$html .= '<a class="rpwe-img" href="' . esc_url(get_permalink()) . '">';
|
125 |
+
if ($image) :
|
126 |
+
$html .= '<img class="' . esc_attr($args['thumb_align']) . ' rpwe-thumb" src="' . esc_url($image) . '" alt="' . esc_attr(get_the_title()) . '" height="' . absint($args['thumb_height']) . '" width="' . absint($args['thumb_width']) . '">';
|
127 |
+
else :
|
128 |
+
$html .= get_the_post_thumbnail(
|
129 |
+
get_the_ID(),
|
130 |
+
array($args['thumb_width'], $args['thumb_height']),
|
131 |
+
array(
|
132 |
+
'class' => $args['thumb_align'] . ' rpwe-thumb the-post-thumbnail',
|
133 |
+
'alt' => esc_attr(get_the_title())
|
134 |
+
)
|
135 |
+
);
|
136 |
+
endif;
|
137 |
+
$html .= '</a>';
|
138 |
+
|
139 |
+
// If no post thumbnail found, check if Get The Image plugin exist and display the image.
|
140 |
+
elseif (function_exists('get_the_image')) :
|
141 |
+
$html .= get_the_image(array(
|
142 |
+
'height' => (int) $args['thumb_height'],
|
143 |
+
'width' => (int) $args['thumb_width'],
|
144 |
+
'image_class' => esc_attr($args['thumb_align']) . ' rpwe-thumb get-the-image',
|
145 |
+
'image_scan' => true,
|
146 |
+
'echo' => false,
|
147 |
+
'default_image' => esc_url($args['thumb_default'])
|
148 |
+
));
|
149 |
+
|
150 |
+
// Display default image.
|
151 |
+
elseif (!empty($args['thumb_default'])) :
|
152 |
+
$html .= sprintf(
|
153 |
+
'<a class="rpwe-img" href="%1$s" rel="bookmark"><img class="%2$s rpwe-thumb rpwe-default-thumb" src="%3$s" alt="%4$s" width="%5$s" height="%6$s"></a>',
|
154 |
+
esc_url(get_permalink()),
|
155 |
+
esc_attr($args['thumb_align']),
|
156 |
+
esc_url($args['thumb_default']),
|
157 |
+
esc_attr(get_the_title()),
|
158 |
+
(int) $args['thumb_width'],
|
159 |
+
(int) $args['thumb_height']
|
160 |
+
);
|
161 |
+
|
162 |
+
endif;
|
163 |
+
|
164 |
+
endif;
|
165 |
+
|
166 |
+
$html .= '<h3 class="rpwe-title"><a href="' . esc_url(get_permalink()) . '" title="' . sprintf(esc_attr__('Permalink to %s', 'recent-posts-widget-extended'), the_title_attribute('echo=0')) . '" rel="bookmark">' . esc_attr(get_the_title()) . '</a></h3>';
|
167 |
+
|
168 |
+
if ($args['date']) :
|
169 |
+
$date = get_the_date();
|
170 |
+
if ($args['date_relative']) :
|
171 |
+
$date = sprintf(__('%s ago', 'recent-posts-widget-extended'), human_time_diff(get_the_date('U'), current_time('timestamp')));
|
172 |
+
endif;
|
173 |
+
$html .= '<time class="rpwe-time published" datetime="' . esc_html(get_the_date('c')) . '">' . esc_html($date) . '</time>';
|
174 |
+
elseif ($args['date_modified']) : // if both date functions are provided, we use date to be backwards compatible
|
175 |
+
$date = get_the_modified_date();
|
176 |
+
if ($args['date_relative']) :
|
177 |
+
$date = sprintf(__('%s ago', 'recent-posts-widget-extended'), human_time_diff(get_the_modified_date('U'), current_time('timestamp')));
|
178 |
+
endif;
|
179 |
+
$html .= '<time class="rpwe-time modfied" datetime="' . esc_html(get_the_modified_date('c')) . '">' . esc_html($date) . '</time>';
|
180 |
+
endif;
|
181 |
+
|
182 |
+
if ($args['comment_count']) :
|
183 |
+
if (get_comments_number() == 0) {
|
184 |
+
$comments = __('No Comments', 'recent-posts-widget-extended');
|
185 |
+
} elseif (get_comments_number() > 1) {
|
186 |
+
$comments = sprintf(__('%s Comments', 'recent-posts-widget-extended'), get_comments_number());
|
187 |
+
} else {
|
188 |
+
$comments = __('1 Comment', 'recent-posts-widget-extended');
|
189 |
+
}
|
190 |
+
$html .= '<a class="rpwe-comment comment-count" href="' . get_comments_link() . '">' . $comments . '</a>';
|
191 |
+
endif;
|
192 |
+
|
193 |
+
if ($args['excerpt']) :
|
194 |
+
$html .= '<div class="rpwe-summary">';
|
195 |
+
$html .= wp_trim_words(apply_filters('rpwe_excerpt', get_the_excerpt()), $args['length'], ' …');
|
196 |
+
if ($args['readmore']) :
|
197 |
+
$html .= '<a href="' . esc_url(get_permalink()) . '" class="more-link">' . $args['readmore_text'] . '</a>';
|
198 |
+
endif;
|
199 |
+
$html .= '</div>';
|
200 |
+
endif;
|
201 |
+
|
202 |
+
$html .= '</li>';
|
203 |
+
|
204 |
+
endwhile;
|
205 |
+
|
206 |
+
$html .= '</ul>';
|
207 |
+
|
208 |
+
$html .= '</div><!-- Generated by http://wordpress.org/plugins/recent-posts-widget-extended/ -->';
|
209 |
+
|
210 |
+
endif;
|
211 |
+
|
212 |
+
// Restore original Post Data.
|
213 |
+
wp_reset_postdata();
|
214 |
+
|
215 |
+
// Allow devs to hook in stuff after the loop.
|
216 |
+
do_action('rpwe_after_loop');
|
217 |
+
|
218 |
+
// Return the posts markup.
|
219 |
+
return wp_kses_post($args['before']) . apply_filters('rpwe_markup', $html, $args) . wp_kses_post($args['after']);
|
220 |
+
}
|
221 |
+
|
222 |
+
/**
|
223 |
+
* The posts query.
|
224 |
+
*
|
225 |
+
* @since 0.0.1
|
226 |
+
* @param array $args
|
227 |
+
* @return array
|
228 |
+
*/
|
229 |
+
function rpwe_get_posts($args = array()) {
|
230 |
+
|
231 |
+
// Query arguments.
|
232 |
+
$query = array(
|
233 |
+
'offset' => $args['offset'],
|
234 |
+
'posts_per_page' => $args['limit'],
|
235 |
+
'orderby' => $args['orderby'],
|
236 |
+
'order' => $args['order'],
|
237 |
+
'post_type' => $args['post_type'],
|
238 |
+
'post_status' => $args['post_status'],
|
239 |
+
'ignore_sticky_posts' => $args['ignore_sticky'],
|
240 |
+
);
|
241 |
+
|
242 |
+
// Exclude current post
|
243 |
+
if ($args['exclude_current']) {
|
244 |
+
$query['post__not_in'] = array(get_the_ID());
|
245 |
+
}
|
246 |
+
|
247 |
+
// Limit posts based on category.
|
248 |
+
if (!empty($args['cat'])) {
|
249 |
+
$query['category__in'] = $args['cat'];
|
250 |
+
}
|
251 |
+
|
252 |
+
// Limit posts based on post tag.
|
253 |
+
if (!empty($args['tag'])) {
|
254 |
+
$query['tag__in'] = $args['tag'];
|
255 |
+
}
|
256 |
+
|
257 |
+
/**
|
258 |
+
* Taxonomy query.
|
259 |
+
* Prop Miniloop plugin by Kailey Lampert.
|
260 |
+
*/
|
261 |
+
if (!empty($args['taxonomy'])) {
|
262 |
+
|
263 |
+
parse_str($args['taxonomy'], $taxes);
|
264 |
+
|
265 |
+
$operator = 'IN';
|
266 |
+
$tax_query = array();
|
267 |
+
foreach (array_keys($taxes) as $k => $slug) {
|
268 |
+
$ids = explode(',', $taxes[$slug]);
|
269 |
+
if (count($ids) == 1 && $ids['0'] < 0) {
|
270 |
+
// If there is only one id given, and it's negative
|
271 |
+
// Let's treat it as 'posts not in'
|
272 |
+
$ids['0'] = $ids['0'] * -1;
|
273 |
+
$operator = 'NOT IN';
|
274 |
+
}
|
275 |
+
$tax_query[] = array(
|
276 |
+
'taxonomy' => $slug,
|
277 |
+
'field' => 'id',
|
278 |
+
'terms' => $ids,
|
279 |
+
'operator' => $operator
|
280 |
+
);
|
281 |
+
}
|
282 |
+
|
283 |
+
$query['tax_query'] = $tax_query;
|
284 |
+
}
|
285 |
+
|
286 |
+
// Allow plugins/themes developer to filter the default query.
|
287 |
+
$query = apply_filters('rpwe_default_query_arguments', $query);
|
288 |
+
|
289 |
+
// Perform the query.
|
290 |
+
$posts = new WP_Query($query);
|
291 |
+
|
292 |
+
return $posts;
|
293 |
+
}
|
294 |
+
|
295 |
+
/**
|
296 |
+
* Custom Styles.
|
297 |
+
*
|
298 |
+
* @since 0.8
|
299 |
+
*/
|
300 |
+
function rpwe_custom_styles() {
|
301 |
+
?>
|
302 |
+
<style>
|
303 |
+
.rpwe-block ul {
|
304 |
+
list-style: none !important;
|
305 |
+
margin-left: 0 !important;
|
306 |
+
padding-left: 0 !important;
|
307 |
+
}
|
308 |
+
|
309 |
+
.rpwe-block li {
|
310 |
+
border-bottom: 1px solid #eee;
|
311 |
+
margin-bottom: 10px;
|
312 |
+
padding-bottom: 10px;
|
313 |
+
list-style-type: none;
|
314 |
+
}
|
315 |
+
|
316 |
+
.rpwe-block a {
|
317 |
+
display: inline !important;
|
318 |
+
text-decoration: none;
|
319 |
+
}
|
320 |
+
|
321 |
+
.rpwe-block h3 {
|
322 |
+
background: none !important;
|
323 |
+
clear: none;
|
324 |
+
margin-bottom: 0 !important;
|
325 |
+
margin-top: 0 !important;
|
326 |
+
font-weight: 400;
|
327 |
+
font-size: 12px !important;
|
328 |
+
line-height: 1.5em;
|
329 |
+
}
|
330 |
+
|
331 |
+
.rpwe-thumb {
|
332 |
+
border: 1px solid #EEE !important;
|
333 |
+
box-shadow: none !important;
|
334 |
+
margin: 2px 10px 2px 0;
|
335 |
+
padding: 3px !important;
|
336 |
+
}
|
337 |
+
|
338 |
+
.rpwe-summary {
|
339 |
+
font-size: 12px;
|
340 |
+
}
|
341 |
+
|
342 |
+
.rpwe-time {
|
343 |
+
color: #bbb;
|
344 |
+
font-size: 11px;
|
345 |
+
}
|
346 |
+
|
347 |
+
.rpwe-comment {
|
348 |
+
color: #bbb;
|
349 |
+
font-size: 11px;
|
350 |
+
padding-left: 5px;
|
351 |
+
}
|
352 |
+
|
353 |
+
.rpwe-alignleft {
|
354 |
+
display: inline;
|
355 |
+
float: left;
|
356 |
+
}
|
357 |
+
|
358 |
+
.rpwe-alignright {
|
359 |
+
display: inline;
|
360 |
+
float: right;
|
361 |
+
}
|
362 |
+
|
363 |
+
.rpwe-aligncenter {
|
364 |
+
display: block;
|
365 |
+
margin-left: auto;
|
366 |
+
margin-right: auto;
|
367 |
+
}
|
368 |
+
|
369 |
+
.rpwe-clearfix:before,
|
370 |
+
.rpwe-clearfix:after {
|
371 |
+
content: "";
|
372 |
+
display: table !important;
|
373 |
+
}
|
374 |
+
|
375 |
+
.rpwe-clearfix:after {
|
376 |
+
clear: both;
|
377 |
+
}
|
378 |
+
|
379 |
+
.rpwe-clearfix {
|
380 |
+
zoom: 1;
|
381 |
+
}
|
382 |
+
</style>
|
383 |
+
<?php
|
384 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
includes/helpers.php
CHANGED
@@ -1,53 +1,47 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Function helper
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
*
|
9 |
-
*
|
10 |
-
* @
|
11 |
-
*/
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
);
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
);
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
// Get the cats
|
50 |
-
$cats = get_terms('category', $args);
|
51 |
-
|
52 |
-
return $cats;
|
53 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Function helper
|
5 |
+
*/
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Display list of tags for widget.
|
9 |
+
*
|
10 |
+
* @since 0.9.9.1
|
11 |
+
*/
|
12 |
+
function rpwe_tags_list() {
|
13 |
+
|
14 |
+
// Arguments
|
15 |
+
$args = array(
|
16 |
+
'number' => 99
|
17 |
+
);
|
18 |
+
|
19 |
+
// Allow dev to filter the arguments
|
20 |
+
$args = apply_filters('rpwe_tags_list_args', $args);
|
21 |
+
|
22 |
+
// Get the tags
|
23 |
+
$tags = get_terms('post_tag', $args);
|
24 |
+
|
25 |
+
return $tags;
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Display list of categories for widget.
|
30 |
+
*
|
31 |
+
* @since 0.9.9.1
|
32 |
+
*/
|
33 |
+
function rpwe_cats_list() {
|
34 |
+
|
35 |
+
// Arguments
|
36 |
+
$args = array(
|
37 |
+
'number' => 99
|
38 |
+
);
|
39 |
+
|
40 |
+
// Allow dev to filter the arguments
|
41 |
+
$args = apply_filters('rpwe_cats_list_args', $args);
|
42 |
+
|
43 |
+
// Get the cats
|
44 |
+
$cats = get_terms('category', $args);
|
45 |
+
|
46 |
+
return $cats;
|
47 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
includes/resizer.php
CHANGED
@@ -1,207 +1,207 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Title : Aqua Resizer
|
5 |
-
* Description : Resizes WordPress images on the fly
|
6 |
-
* Version : 1.2.0
|
7 |
-
* Author : Syamil MJ
|
8 |
-
* Author URI : http://aquagraphite.com
|
9 |
-
* License : WTFPL - http://sam.zoy.org/wtfpl/
|
10 |
-
* Documentation : https://github.com/sy4mil/Aqua-Resizer/
|
11 |
-
*
|
12 |
-
* I changed the function and class name for compatibility purpose. It somtimes conflicted with a theme which uses the same library.
|
13 |
-
*
|
14 |
-
* @param string $url - (required) must be uploaded using wp media uploader
|
15 |
-
* @param int $width - (required)
|
16 |
-
* @param int $height - (optional)
|
17 |
-
* @param bool $crop - (optional) default to soft crop
|
18 |
-
* @param bool $single - (optional) returns an array if false
|
19 |
-
* @param bool $upscale - (optional) resizes smaller images
|
20 |
-
* @uses wp_upload_dir()
|
21 |
-
* @uses image_resize_dimensions()
|
22 |
-
* @uses wp_get_image_editor()
|
23 |
-
*
|
24 |
-
* @return str|array
|
25 |
-
*/
|
26 |
-
|
27 |
-
if (!class_exists('Rpwe_Resize')) {
|
28 |
-
class Rpwe_Resize {
|
29 |
-
/**
|
30 |
-
* The singleton instance
|
31 |
-
*/
|
32 |
-
static private $instance = null;
|
33 |
-
|
34 |
-
/**
|
35 |
-
* No initialization allowed
|
36 |
-
*/
|
37 |
-
private function __construct() {
|
38 |
-
}
|
39 |
-
|
40 |
-
/**
|
41 |
-
* No cloning allowed
|
42 |
-
*/
|
43 |
-
private function __clone() {
|
44 |
-
}
|
45 |
-
|
46 |
-
/**
|
47 |
-
* For your custom default usage you may want to initialize an Rpwe_Resize object by yourself and then have own defaults
|
48 |
-
*/
|
49 |
-
static public function getInstance() {
|
50 |
-
if (self::$instance == null) {
|
51 |
-
self::$instance = new self;
|
52 |
-
}
|
53 |
-
|
54 |
-
return self::$instance;
|
55 |
-
}
|
56 |
-
|
57 |
-
/**
|
58 |
-
* Run, forest.
|
59 |
-
*/
|
60 |
-
public function process($url, $width = null, $height = null, $crop = null, $single = true, $upscale = false) {
|
61 |
-
// Validate inputs.
|
62 |
-
if (!$url || (!$width && !$height)) return false;
|
63 |
-
|
64 |
-
// Caipt'n, ready to hook.
|
65 |
-
if (true === $upscale) add_filter('image_resize_dimensions', array($this, 'rpwe_upscale'), 10, 6);
|
66 |
-
|
67 |
-
// Define upload path & dir.
|
68 |
-
$upload_info = wp_upload_dir();
|
69 |
-
$upload_dir = $upload_info['basedir'];
|
70 |
-
$upload_url = $upload_info['baseurl'];
|
71 |
-
|
72 |
-
$http_prefix = "http://";
|
73 |
-
$https_prefix = "https://";
|
74 |
-
|
75 |
-
/* if the $url scheme differs from $upload_url scheme, make them match
|
76 |
-
if the schemes differe, images don't show up. */
|
77 |
-
if (!strncmp($url, $https_prefix, strlen($https_prefix))) { //if url begins with https:// make $upload_url begin with https:// as well
|
78 |
-
$upload_url = str_replace($http_prefix, $https_prefix, $upload_url);
|
79 |
-
} elseif (!strncmp($url, $http_prefix, strlen($http_prefix))) { //if url begins with http:// make $upload_url begin with http:// as well
|
80 |
-
$upload_url = str_replace($https_prefix, $http_prefix, $upload_url);
|
81 |
-
}
|
82 |
-
|
83 |
-
|
84 |
-
// Check if $img_url is local.
|
85 |
-
if (false === strpos($url, $upload_url)) return false;
|
86 |
-
|
87 |
-
// Define path of image.
|
88 |
-
$rel_path = str_replace($upload_url, '', $url);
|
89 |
-
$img_path = $upload_dir . $rel_path;
|
90 |
-
|
91 |
-
// Check if img path exists, and is an image indeed.
|
92 |
-
if (!file_exists($img_path) or !getimagesize($img_path)) return false;
|
93 |
-
|
94 |
-
// Get image info.
|
95 |
-
$info = pathinfo($img_path);
|
96 |
-
$ext = $info['extension'];
|
97 |
-
list($orig_w, $orig_h) = getimagesize($img_path);
|
98 |
-
|
99 |
-
// Get image size after cropping.
|
100 |
-
$dims = image_resize_dimensions($orig_w, $orig_h, $width, $height, $crop);
|
101 |
-
$dst_w = $dims[4];
|
102 |
-
$dst_h = $dims[5];
|
103 |
-
|
104 |
-
// Return the original image only if it exactly fits the needed measures.
|
105 |
-
if (!$dims && (((null === $height && $orig_w == $width) xor (null === $width && $orig_h == $height)) xor ($height == $orig_h && $width == $orig_w))) {
|
106 |
-
$img_url = $url;
|
107 |
-
$dst_w = $orig_w;
|
108 |
-
$dst_h = $orig_h;
|
109 |
-
} else {
|
110 |
-
// Use this to check if cropped image already exists, so we can return that instead.
|
111 |
-
$suffix = "{$dst_w}x{$dst_h}";
|
112 |
-
$dst_rel_path = str_replace('.' . $ext, '', $rel_path);
|
113 |
-
$destfilename = "{$upload_dir}{$dst_rel_path}-{$suffix}.{$ext}";
|
114 |
-
|
115 |
-
if (!$dims || (true == $crop && false == $upscale && ($dst_w < $width || $dst_h < $height))) {
|
116 |
-
// Can't resize, so return false saying that the action to do could not be processed as planned.
|
117 |
-
return false;
|
118 |
-
}
|
119 |
-
// Else check if cache exists.
|
120 |
-
elseif (file_exists($destfilename) && getimagesize($destfilename)) {
|
121 |
-
$img_url = "{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}";
|
122 |
-
}
|
123 |
-
// Else, we resize the image and return the new resized image url.
|
124 |
-
else {
|
125 |
-
|
126 |
-
$editor = wp_get_image_editor($img_path);
|
127 |
-
|
128 |
-
if (is_wp_error($editor) || is_wp_error($editor->resize($width, $height, $crop)))
|
129 |
-
return false;
|
130 |
-
|
131 |
-
$resized_file = $editor->save();
|
132 |
-
|
133 |
-
if (!is_wp_error($resized_file)) {
|
134 |
-
$resized_rel_path = str_replace($upload_dir, '', $resized_file['path']);
|
135 |
-
$img_url = $upload_url . $resized_rel_path;
|
136 |
-
} else {
|
137 |
-
return false;
|
138 |
-
}
|
139 |
-
}
|
140 |
-
}
|
141 |
-
|
142 |
-
// Okay, leave the ship.
|
143 |
-
if (true === $upscale) remove_filter('image_resize_dimensions', array($this, 'rpwe_upscale'));
|
144 |
-
|
145 |
-
// Return the output.
|
146 |
-
if ($single) {
|
147 |
-
// str return.
|
148 |
-
$image = $img_url;
|
149 |
-
} else {
|
150 |
-
// array return.
|
151 |
-
$image = array(
|
152 |
-
0 => $img_url,
|
153 |
-
1 => $dst_w,
|
154 |
-
2 => $dst_h
|
155 |
-
);
|
156 |
-
}
|
157 |
-
|
158 |
-
return $image;
|
159 |
-
}
|
160 |
-
|
161 |
-
/**
|
162 |
-
* Callback to overwrite WP computing of thumbnail measures
|
163 |
-
*/
|
164 |
-
function rpwe_upscale($default, $orig_w, $orig_h, $dest_w, $dest_h, $crop) {
|
165 |
-
if (!$crop) return null; // Let the wordpress default function handle this.
|
166 |
-
|
167 |
-
// Here is the point we allow to use larger image size than the original one.
|
168 |
-
$aspect_ratio = $orig_w / $orig_h;
|
169 |
-
$new_w = $dest_w;
|
170 |
-
$new_h = $dest_h;
|
171 |
-
|
172 |
-
if (!$new_w) {
|
173 |
-
$new_w = intval($new_h * $aspect_ratio);
|
174 |
-
}
|
175 |
-
|
176 |
-
if (!$new_h) {
|
177 |
-
$new_h = intval($new_w / $aspect_ratio);
|
178 |
-
}
|
179 |
-
|
180 |
-
$size_ratio = max($new_w / $orig_w, $new_h / $orig_h);
|
181 |
-
|
182 |
-
$crop_w = round($new_w / $size_ratio);
|
183 |
-
$crop_h = round($new_h / $size_ratio);
|
184 |
-
|
185 |
-
$s_x = floor(($orig_w - $crop_w) / 2);
|
186 |
-
$s_y = floor(($orig_h - $crop_h) / 2);
|
187 |
-
|
188 |
-
return array(0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h);
|
189 |
-
}
|
190 |
-
}
|
191 |
-
}
|
192 |
-
|
193 |
-
|
194 |
-
|
195 |
-
|
196 |
-
|
197 |
-
if (!function_exists('rpwe_resize')) {
|
198 |
-
|
199 |
-
/**
|
200 |
-
* This is just a tiny wrapper function for the class above so that there is no
|
201 |
-
* need to change any code in your own WP themes. Usage is still the same :)
|
202 |
-
*/
|
203 |
-
function rpwe_resize($url, $width = null, $height = null, $crop = null, $single = true, $upscale = false) {
|
204 |
-
$rpwe_resize = Rpwe_Resize::getInstance();
|
205 |
-
return $rpwe_resize->process($url, $width, $height, $crop, $single, $upscale);
|
206 |
-
}
|
207 |
-
}
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Title : Aqua Resizer
|
5 |
+
* Description : Resizes WordPress images on the fly
|
6 |
+
* Version : 1.2.0
|
7 |
+
* Author : Syamil MJ
|
8 |
+
* Author URI : http://aquagraphite.com
|
9 |
+
* License : WTFPL - http://sam.zoy.org/wtfpl/
|
10 |
+
* Documentation : https://github.com/sy4mil/Aqua-Resizer/
|
11 |
+
*
|
12 |
+
* I changed the function and class name for compatibility purpose. It somtimes conflicted with a theme which uses the same library.
|
13 |
+
*
|
14 |
+
* @param string $url - (required) must be uploaded using wp media uploader
|
15 |
+
* @param int $width - (required)
|
16 |
+
* @param int $height - (optional)
|
17 |
+
* @param bool $crop - (optional) default to soft crop
|
18 |
+
* @param bool $single - (optional) returns an array if false
|
19 |
+
* @param bool $upscale - (optional) resizes smaller images
|
20 |
+
* @uses wp_upload_dir()
|
21 |
+
* @uses image_resize_dimensions()
|
22 |
+
* @uses wp_get_image_editor()
|
23 |
+
*
|
24 |
+
* @return str|array
|
25 |
+
*/
|
26 |
+
|
27 |
+
if (!class_exists('Rpwe_Resize')) {
|
28 |
+
class Rpwe_Resize {
|
29 |
+
/**
|
30 |
+
* The singleton instance
|
31 |
+
*/
|
32 |
+
static private $instance = null;
|
33 |
+
|
34 |
+
/**
|
35 |
+
* No initialization allowed
|
36 |
+
*/
|
37 |
+
private function __construct() {
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* No cloning allowed
|
42 |
+
*/
|
43 |
+
private function __clone() {
|
44 |
+
}
|
45 |
+
|
46 |
+
/**
|
47 |
+
* For your custom default usage you may want to initialize an Rpwe_Resize object by yourself and then have own defaults
|
48 |
+
*/
|
49 |
+
static public function getInstance() {
|
50 |
+
if (self::$instance == null) {
|
51 |
+
self::$instance = new self;
|
52 |
+
}
|
53 |
+
|
54 |
+
return self::$instance;
|
55 |
+
}
|
56 |
+
|
57 |
+
/**
|
58 |
+
* Run, forest.
|
59 |
+
*/
|
60 |
+
public function process($url, $width = null, $height = null, $crop = null, $single = true, $upscale = false) {
|
61 |
+
// Validate inputs.
|
62 |
+
if (!$url || (!$width && !$height)) return false;
|
63 |
+
|
64 |
+
// Caipt'n, ready to hook.
|
65 |
+
if (true === $upscale) add_filter('image_resize_dimensions', array($this, 'rpwe_upscale'), 10, 6);
|
66 |
+
|
67 |
+
// Define upload path & dir.
|
68 |
+
$upload_info = wp_upload_dir();
|
69 |
+
$upload_dir = $upload_info['basedir'];
|
70 |
+
$upload_url = $upload_info['baseurl'];
|
71 |
+
|
72 |
+
$http_prefix = "http://";
|
73 |
+
$https_prefix = "https://";
|
74 |
+
|
75 |
+
/* if the $url scheme differs from $upload_url scheme, make them match
|
76 |
+
if the schemes differe, images don't show up. */
|
77 |
+
if (!strncmp($url, $https_prefix, strlen($https_prefix))) { //if url begins with https:// make $upload_url begin with https:// as well
|
78 |
+
$upload_url = str_replace($http_prefix, $https_prefix, $upload_url);
|
79 |
+
} elseif (!strncmp($url, $http_prefix, strlen($http_prefix))) { //if url begins with http:// make $upload_url begin with http:// as well
|
80 |
+
$upload_url = str_replace($https_prefix, $http_prefix, $upload_url);
|
81 |
+
}
|
82 |
+
|
83 |
+
|
84 |
+
// Check if $img_url is local.
|
85 |
+
if (false === strpos($url, $upload_url)) return false;
|
86 |
+
|
87 |
+
// Define path of image.
|
88 |
+
$rel_path = str_replace($upload_url, '', $url);
|
89 |
+
$img_path = $upload_dir . $rel_path;
|
90 |
+
|
91 |
+
// Check if img path exists, and is an image indeed.
|
92 |
+
if (!file_exists($img_path) or !getimagesize($img_path)) return false;
|
93 |
+
|
94 |
+
// Get image info.
|
95 |
+
$info = pathinfo($img_path);
|
96 |
+
$ext = $info['extension'];
|
97 |
+
list($orig_w, $orig_h) = getimagesize($img_path);
|
98 |
+
|
99 |
+
// Get image size after cropping.
|
100 |
+
$dims = image_resize_dimensions($orig_w, $orig_h, $width, $height, $crop);
|
101 |
+
$dst_w = $dims[4];
|
102 |
+
$dst_h = $dims[5];
|
103 |
+
|
104 |
+
// Return the original image only if it exactly fits the needed measures.
|
105 |
+
if (!$dims && (((null === $height && $orig_w == $width) xor (null === $width && $orig_h == $height)) xor ($height == $orig_h && $width == $orig_w))) {
|
106 |
+
$img_url = $url;
|
107 |
+
$dst_w = $orig_w;
|
108 |
+
$dst_h = $orig_h;
|
109 |
+
} else {
|
110 |
+
// Use this to check if cropped image already exists, so we can return that instead.
|
111 |
+
$suffix = "{$dst_w}x{$dst_h}";
|
112 |
+
$dst_rel_path = str_replace('.' . $ext, '', $rel_path);
|
113 |
+
$destfilename = "{$upload_dir}{$dst_rel_path}-{$suffix}.{$ext}";
|
114 |
+
|
115 |
+
if (!$dims || (true == $crop && false == $upscale && ($dst_w < $width || $dst_h < $height))) {
|
116 |
+
// Can't resize, so return false saying that the action to do could not be processed as planned.
|
117 |
+
return false;
|
118 |
+
}
|
119 |
+
// Else check if cache exists.
|
120 |
+
elseif (file_exists($destfilename) && getimagesize($destfilename)) {
|
121 |
+
$img_url = "{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}";
|
122 |
+
}
|
123 |
+
// Else, we resize the image and return the new resized image url.
|
124 |
+
else {
|
125 |
+
|
126 |
+
$editor = wp_get_image_editor($img_path);
|
127 |
+
|
128 |
+
if (is_wp_error($editor) || is_wp_error($editor->resize($width, $height, $crop)))
|
129 |
+
return false;
|
130 |
+
|
131 |
+
$resized_file = $editor->save();
|
132 |
+
|
133 |
+
if (!is_wp_error($resized_file)) {
|
134 |
+
$resized_rel_path = str_replace($upload_dir, '', $resized_file['path']);
|
135 |
+
$img_url = $upload_url . $resized_rel_path;
|
136 |
+
} else {
|
137 |
+
return false;
|
138 |
+
}
|
139 |
+
}
|
140 |
+
}
|
141 |
+
|
142 |
+
// Okay, leave the ship.
|
143 |
+
if (true === $upscale) remove_filter('image_resize_dimensions', array($this, 'rpwe_upscale'));
|
144 |
+
|
145 |
+
// Return the output.
|
146 |
+
if ($single) {
|
147 |
+
// str return.
|
148 |
+
$image = $img_url;
|
149 |
+
} else {
|
150 |
+
// array return.
|
151 |
+
$image = array(
|
152 |
+
0 => $img_url,
|
153 |
+
1 => $dst_w,
|
154 |
+
2 => $dst_h
|
155 |
+
);
|
156 |
+
}
|
157 |
+
|
158 |
+
return $image;
|
159 |
+
}
|
160 |
+
|
161 |
+
/**
|
162 |
+
* Callback to overwrite WP computing of thumbnail measures
|
163 |
+
*/
|
164 |
+
function rpwe_upscale($default, $orig_w, $orig_h, $dest_w, $dest_h, $crop) {
|
165 |
+
if (!$crop) return null; // Let the wordpress default function handle this.
|
166 |
+
|
167 |
+
// Here is the point we allow to use larger image size than the original one.
|
168 |
+
$aspect_ratio = $orig_w / $orig_h;
|
169 |
+
$new_w = $dest_w;
|
170 |
+
$new_h = $dest_h;
|
171 |
+
|
172 |
+
if (!$new_w) {
|
173 |
+
$new_w = intval($new_h * $aspect_ratio);
|
174 |
+
}
|
175 |
+
|
176 |
+
if (!$new_h) {
|
177 |
+
$new_h = intval($new_w / $aspect_ratio);
|
178 |
+
}
|
179 |
+
|
180 |
+
$size_ratio = max($new_w / $orig_w, $new_h / $orig_h);
|
181 |
+
|
182 |
+
$crop_w = round($new_w / $size_ratio);
|
183 |
+
$crop_h = round($new_h / $size_ratio);
|
184 |
+
|
185 |
+
$s_x = floor(($orig_w - $crop_w) / 2);
|
186 |
+
$s_y = floor(($orig_h - $crop_h) / 2);
|
187 |
+
|
188 |
+
return array(0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h);
|
189 |
+
}
|
190 |
+
}
|
191 |
+
}
|
192 |
+
|
193 |
+
|
194 |
+
|
195 |
+
|
196 |
+
|
197 |
+
if (!function_exists('rpwe_resize')) {
|
198 |
+
|
199 |
+
/**
|
200 |
+
* This is just a tiny wrapper function for the class above so that there is no
|
201 |
+
* need to change any code in your own WP themes. Usage is still the same :)
|
202 |
+
*/
|
203 |
+
function rpwe_resize($url, $width = null, $height = null, $crop = null, $single = true, $upscale = false) {
|
204 |
+
$rpwe_resize = Rpwe_Resize::getInstance();
|
205 |
+
return $rpwe_resize->process($url, $width, $height, $crop, $single, $upscale);
|
206 |
+
}
|
207 |
+
}
|
includes/shortcode.php
CHANGED
@@ -1,26 +1,20 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Shortcode helper
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
*
|
9 |
-
*
|
10 |
-
* @
|
11 |
-
*/
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
unset($atts['cssid']);
|
22 |
-
}
|
23 |
-
$args = shortcode_atts(rpwe_get_default_args(), $atts);
|
24 |
-
return rpwe_get_recent_posts($args);
|
25 |
-
}
|
26 |
-
add_shortcode('rpwe', 'rpwe_shortcode');
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Shortcode helper
|
5 |
+
*/
|
6 |
+
|
7 |
+
/**
|
8 |
+
* Display recent posts with shortcode.
|
9 |
+
*
|
10 |
+
* @since 0.9.4
|
11 |
+
*/
|
12 |
+
function rpwe_shortcode($atts, $content) {
|
13 |
+
if (isset($atts['cssid'])) {
|
14 |
+
$atts['cssID'] = $atts['cssid'];
|
15 |
+
unset($atts['cssid']);
|
16 |
+
}
|
17 |
+
$args = shortcode_atts(rpwe_get_default_args(), $atts);
|
18 |
+
return rpwe_get_recent_posts($args);
|
19 |
+
}
|
20 |
+
add_shortcode('rpwe', 'rpwe_shortcode');
|
|
|
|
|
|
|
|
|
|
|
|
languages/recent-posts-widget-extended-de_DE.mo
CHANGED
File without changes
|
languages/recent-posts-widget-extended-de_DE.po
CHANGED
File without changes
|
languages/recent-posts-widget-extended-fa_IR.mo
CHANGED
File without changes
|
languages/recent-posts-widget-extended-fa_IR.po
CHANGED
File without changes
|
languages/recent-posts-widget-extended-fr_FR.mo
CHANGED
File without changes
|
languages/recent-posts-widget-extended-fr_FR.po
CHANGED
File without changes
|
languages/recent-posts-widget-extended-pt_BR.mo
CHANGED
File without changes
|
languages/recent-posts-widget-extended-pt_BR.po
CHANGED
File without changes
|
languages/recent-posts-widget-extended.pot
CHANGED
@@ -13,178 +13,178 @@ msgstr ""
|
|
13 |
"X-Poedit-SourceCharset: UTF-8\n"
|
14 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
15 |
|
16 |
-
#: classes/widget.php:
|
17 |
msgid "An advanced widget that gives you total control over the output of your site’s most recent Posts."
|
18 |
msgstr ""
|
19 |
|
20 |
-
#: classes/widget.php:
|
21 |
msgid "Recent Posts Extended"
|
22 |
msgstr ""
|
23 |
|
24 |
-
#: includes/form.php:
|
25 |
msgid "Title"
|
26 |
msgstr ""
|
27 |
|
28 |
-
#: includes/form.php:
|
29 |
msgid "Title URL"
|
30 |
msgstr ""
|
31 |
|
32 |
-
#: includes/form.php:
|
33 |
msgid "CSS ID"
|
34 |
msgstr ""
|
35 |
|
36 |
-
#: includes/form.php:
|
37 |
msgid "CSS Class"
|
38 |
msgstr ""
|
39 |
|
40 |
-
#: includes/form.php:
|
41 |
msgid "HTML or text before the recent posts"
|
42 |
msgstr ""
|
43 |
|
44 |
-
#: includes/form.php:
|
45 |
msgid "HTML or text after the recent posts"
|
46 |
msgstr ""
|
47 |
|
48 |
-
#: includes/form.php:
|
49 |
msgid "Ignore sticky posts"
|
50 |
msgstr ""
|
51 |
|
52 |
-
#: includes/form.php:
|
53 |
msgid "Exclude current post"
|
54 |
msgstr ""
|
55 |
|
56 |
-
#: includes/form.php:
|
57 |
msgid "Post Types"
|
58 |
msgstr ""
|
59 |
|
60 |
-
#: includes/form.php:
|
61 |
msgid "Post Status"
|
62 |
msgstr ""
|
63 |
|
64 |
-
#: includes/form.php:
|
65 |
msgid "Order"
|
66 |
msgstr ""
|
67 |
|
68 |
-
#: includes/form.php:
|
69 |
msgid "Orderby"
|
70 |
msgstr ""
|
71 |
|
72 |
-
#: includes/form.php:
|
73 |
msgid "Limit to Category"
|
74 |
msgstr ""
|
75 |
|
76 |
-
#: includes/form.php:
|
77 |
msgid "Limit to Tag"
|
78 |
msgstr ""
|
79 |
|
80 |
-
#: includes/form.php:
|
81 |
msgid "Limit to Taxonomy"
|
82 |
msgstr ""
|
83 |
|
84 |
-
#: includes/form.php:
|
85 |
msgid "Number of posts to show"
|
86 |
msgstr ""
|
87 |
|
88 |
-
#: includes/form.php:
|
89 |
msgid "Offset"
|
90 |
msgstr ""
|
91 |
|
92 |
-
#: includes/form.php:
|
93 |
msgid "The number of posts to skip"
|
94 |
msgstr ""
|
95 |
|
96 |
-
#: includes/form.php:
|
97 |
msgid "Display Thumbnail"
|
98 |
msgstr ""
|
99 |
|
100 |
-
#: includes/form.php:
|
101 |
msgid "Thumbnail (height,width,align)"
|
102 |
msgstr ""
|
103 |
|
104 |
-
#: includes/form.php:
|
105 |
msgid "Left"
|
106 |
msgstr ""
|
107 |
|
108 |
-
#: includes/form.php:
|
109 |
msgid "Right"
|
110 |
msgstr ""
|
111 |
|
112 |
-
#: includes/form.php:
|
113 |
msgid "Center"
|
114 |
msgstr ""
|
115 |
|
116 |
-
#: includes/form.php:
|
117 |
msgid "Default Thumbnail"
|
118 |
msgstr ""
|
119 |
|
120 |
-
#: includes/form.php:
|
121 |
msgid "Leave it blank to disable."
|
122 |
msgstr ""
|
123 |
|
124 |
-
#: includes/form.php:
|
125 |
msgid "Display Excerpt"
|
126 |
msgstr ""
|
127 |
|
128 |
-
#: includes/form.php:
|
129 |
msgid "Excerpt Length"
|
130 |
msgstr ""
|
131 |
|
132 |
-
#: includes/form.php:
|
133 |
msgid "Display Readmore"
|
134 |
msgstr ""
|
135 |
|
136 |
-
#: includes/form.php:
|
137 |
msgid "Readmore Text"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: includes/form.php:
|
141 |
msgid "Display Comment Count"
|
142 |
msgstr ""
|
143 |
|
144 |
-
#: includes/form.php:
|
145 |
msgid "Display Date"
|
146 |
msgstr ""
|
147 |
|
148 |
-
#: includes/form.php:
|
149 |
msgid "Display Modification Date"
|
150 |
msgstr ""
|
151 |
|
152 |
-
#: includes/form.php:
|
153 |
msgid "Use Relative Date. eg: 5 days ago"
|
154 |
msgstr ""
|
155 |
|
156 |
-
#: includes/form.php:
|
157 |
msgid "Use Default Styles"
|
158 |
msgstr ""
|
159 |
|
160 |
-
#: includes/form.php:
|
161 |
msgid "Custom CSS"
|
162 |
msgstr ""
|
163 |
|
164 |
-
#: includes/form.php:
|
165 |
msgid "If you turn off the default styles, you can use these css code to customize the recent posts style."
|
166 |
msgstr ""
|
167 |
|
168 |
-
#: includes/functions.php:
|
169 |
msgid "Read More »"
|
170 |
msgstr ""
|
171 |
|
172 |
-
#: includes/functions.php:
|
173 |
msgid "Permalink to %s"
|
174 |
msgstr ""
|
175 |
|
176 |
-
#: includes/functions.php:
|
177 |
msgid "%s ago"
|
178 |
msgstr ""
|
179 |
|
180 |
-
#: includes/functions.php:
|
181 |
msgid "1 Comment"
|
182 |
msgstr ""
|
183 |
|
184 |
-
#: includes/functions.php:
|
185 |
msgid "%s Comments"
|
186 |
msgstr ""
|
187 |
|
188 |
-
#: includes/functions.php:
|
189 |
msgid "No Comments"
|
190 |
msgstr ""
|
13 |
"X-Poedit-SourceCharset: UTF-8\n"
|
14 |
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
15 |
|
16 |
+
#: classes/widget.php:19
|
17 |
msgid "An advanced widget that gives you total control over the output of your site’s most recent Posts."
|
18 |
msgstr ""
|
19 |
|
20 |
+
#: classes/widget.php:31
|
21 |
msgid "Recent Posts Extended"
|
22 |
msgstr ""
|
23 |
|
24 |
+
#: includes/form.php:12
|
25 |
msgid "Title"
|
26 |
msgstr ""
|
27 |
|
28 |
+
#: includes/form.php:19
|
29 |
msgid "Title URL"
|
30 |
msgstr ""
|
31 |
|
32 |
+
#: includes/form.php:26
|
33 |
msgid "CSS ID"
|
34 |
msgstr ""
|
35 |
|
36 |
+
#: includes/form.php:33
|
37 |
msgid "CSS Class"
|
38 |
msgstr ""
|
39 |
|
40 |
+
#: includes/form.php:40
|
41 |
msgid "HTML or text before the recent posts"
|
42 |
msgstr ""
|
43 |
|
44 |
+
#: includes/form.php:47
|
45 |
msgid "HTML or text after the recent posts"
|
46 |
msgstr ""
|
47 |
|
48 |
+
#: includes/form.php:56
|
49 |
msgid "Ignore sticky posts"
|
50 |
msgstr ""
|
51 |
|
52 |
+
#: includes/form.php:63
|
53 |
msgid "Exclude current post"
|
54 |
msgstr ""
|
55 |
|
56 |
+
#: includes/form.php:69
|
57 |
msgid "Post Types"
|
58 |
msgstr ""
|
59 |
|
60 |
+
#: includes/form.php:83
|
61 |
msgid "Post Status"
|
62 |
msgstr ""
|
63 |
|
64 |
+
#: includes/form.php:94
|
65 |
msgid "Order"
|
66 |
msgstr ""
|
67 |
|
68 |
+
#: includes/form.php:104
|
69 |
msgid "Orderby"
|
70 |
msgstr ""
|
71 |
|
72 |
+
#: includes/form.php:120
|
73 |
msgid "Limit to Category"
|
74 |
msgstr ""
|
75 |
|
76 |
+
#: includes/form.php:135
|
77 |
msgid "Limit to Tag"
|
78 |
msgstr ""
|
79 |
|
80 |
+
#: includes/form.php:149
|
81 |
msgid "Limit to Taxonomy"
|
82 |
msgstr ""
|
83 |
|
84 |
+
#: includes/form.php:159
|
85 |
msgid "Number of posts to show"
|
86 |
msgstr ""
|
87 |
|
88 |
+
#: includes/form.php:166
|
89 |
msgid "Offset"
|
90 |
msgstr ""
|
91 |
|
92 |
+
#: includes/form.php:169
|
93 |
msgid "The number of posts to skip"
|
94 |
msgstr ""
|
95 |
|
96 |
+
#: includes/form.php:177
|
97 |
msgid "Display Thumbnail"
|
98 |
msgstr ""
|
99 |
|
100 |
+
#: includes/form.php:183
|
101 |
msgid "Thumbnail (height,width,align)"
|
102 |
msgstr ""
|
103 |
|
104 |
+
#: includes/form.php:191
|
105 |
msgid "Left"
|
106 |
msgstr ""
|
107 |
|
108 |
+
#: includes/form.php:192
|
109 |
msgid "Right"
|
110 |
msgstr ""
|
111 |
|
112 |
+
#: includes/form.php:193
|
113 |
msgid "Center"
|
114 |
msgstr ""
|
115 |
|
116 |
+
#: includes/form.php:199
|
117 |
msgid "Default Thumbnail"
|
118 |
msgstr ""
|
119 |
|
120 |
+
#: includes/form.php:202
|
121 |
msgid "Leave it blank to disable."
|
122 |
msgstr ""
|
123 |
|
124 |
+
#: includes/form.php:210
|
125 |
msgid "Display Excerpt"
|
126 |
msgstr ""
|
127 |
|
128 |
+
#: includes/form.php:216
|
129 |
msgid "Excerpt Length"
|
130 |
msgstr ""
|
131 |
|
132 |
+
#: includes/form.php:224
|
133 |
msgid "Display Readmore"
|
134 |
msgstr ""
|
135 |
|
136 |
+
#: includes/form.php:230
|
137 |
msgid "Readmore Text"
|
138 |
msgstr ""
|
139 |
|
140 |
+
#: includes/form.php:238
|
141 |
msgid "Display Comment Count"
|
142 |
msgstr ""
|
143 |
|
144 |
+
#: includes/form.php:245
|
145 |
msgid "Display Date"
|
146 |
msgstr ""
|
147 |
|
148 |
+
#: includes/form.php:252
|
149 |
msgid "Display Modification Date"
|
150 |
msgstr ""
|
151 |
|
152 |
+
#: includes/form.php:259
|
153 |
msgid "Use Relative Date. eg: 5 days ago"
|
154 |
msgstr ""
|
155 |
|
156 |
+
#: includes/form.php:267
|
157 |
msgid "Use Default Styles"
|
158 |
msgstr ""
|
159 |
|
160 |
+
#: includes/form.php:273
|
161 |
msgid "Custom CSS"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: includes/form.php:276
|
165 |
msgid "If you turn off the default styles, you can use these css code to customize the recent posts style."
|
166 |
msgstr ""
|
167 |
|
168 |
+
#: includes/functions.php:43
|
169 |
msgid "Read More »"
|
170 |
msgstr ""
|
171 |
|
172 |
+
#: includes/functions.php:166
|
173 |
msgid "Permalink to %s"
|
174 |
msgstr ""
|
175 |
|
176 |
+
#: includes/functions.php:177, includes/functions.php:171
|
177 |
msgid "%s ago"
|
178 |
msgstr ""
|
179 |
|
180 |
+
#: includes/functions.php:188
|
181 |
msgid "1 Comment"
|
182 |
msgstr ""
|
183 |
|
184 |
+
#: includes/functions.php:186
|
185 |
msgid "%s Comments"
|
186 |
msgstr ""
|
187 |
|
188 |
+
#: includes/functions.php:184
|
189 |
msgid "No Comments"
|
190 |
msgstr ""
|
readme.txt
CHANGED
@@ -1,237 +1,252 @@
|
|
1 |
-
=== Recent Posts Widget Extended ===
|
2 |
-
Contributors: idenovasi, satrya
|
3 |
-
Donate link: https://paypal.me/satrya
|
4 |
-
Tags: recent posts, random posts, popular posts, thumbnails, widget, widgets, sidebar, excerpt, category, post tag, taxonomy, post type, post status, shortcode, multiple widgets
|
5 |
-
Requires at least:
|
6 |
-
Tested up to: 5.
|
7 |
-
Requires PHP: 7.2
|
8 |
-
Stable tag: 1.
|
9 |
-
License: GPLv2 or later
|
10 |
-
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
-
|
12 |
-
Provides flexible and advanced recent posts. Display it via shortcode or widget with thumbnails, post excerpt, taxonomy and more.
|
13 |
-
|
14 |
-
== Description ==
|
15 |
-
|
16 |
-
This plugin will enable a custom, flexible and super [advanced recent posts](https://idenovasi.com/projects/recent-posts-widget-extended/), you can display it via shortcode or widget. Allows you to display a list of the most recent posts with thumbnail, excerpt and post date, also you can display it from all or specific or multiple taxonomy, post type and much more!
|
17 |
-
|
18 |
-
= Features Include =
|
19 |
-
|
20 |
-
* Taxonomy support!
|
21 |
-
* Post status option.
|
22 |
-
* Custom html or text before and/or after recent posts.
|
23 |
-
* Available filter for dev.
|
24 |
-
* Shortcode feature.
|
25 |
-
* Better image cropping.
|
26 |
-
* Allow you to set title url.
|
27 |
-
* Display by date, comment count or random.
|
28 |
-
* Display thumbnails, with customizable size and alignment.
|
29 |
-
* Display excerpt, with customizable length.
|
30 |
-
* Display from all, specific or multiple category.
|
31 |
-
* Display from all, specific or multiple tag.
|
32 |
-
* Display post date.
|
33 |
-
* Display modification date
|
34 |
-
* Display comment count
|
35 |
-
* Exclude current post
|
36 |
-
* Read more option.
|
37 |
-
* Post type option.
|
38 |
-
* Custom CSS.
|
39 |
-
* Multiple widgets.
|
40 |
-
|
41 |
-
= Support this project =
|
42 |
-
|
43 |
-
* [Translate to your language](https://translate.wordpress.org/projects/wp-plugins/recent-posts-widget-extended/).
|
44 |
-
* Contribute on [Github](https://github.com/
|
45 |
-
* [Donate](https://paypal.me/satrya).
|
46 |
-
|
47 |
-
== Installation ==
|
48 |
-
|
49 |
-
**Through Dashboard**
|
50 |
-
|
51 |
-
1. Log in to your WordPress admin panel and go to Plugins -> Add New
|
52 |
-
2. Type **recent posts widget extended** in the search box and click on search button.
|
53 |
-
3. Find Recent Posts Widget Extended plugin.
|
54 |
-
4. Then click on Install Now after that activate the plugin.
|
55 |
-
5. Go to the widgets page **Appearance -> Widgets**.
|
56 |
-
6. Find **Recent Posts Extended** widget.
|
57 |
-
|
58 |
-
**Installing Via FTP**
|
59 |
-
|
60 |
-
1. Download the plugin to your hardisk.
|
61 |
-
2. Unzip.
|
62 |
-
3. Upload the **recent-posts-widget-extended** folder into your plugins directory.
|
63 |
-
4. Log in to your WordPress admin panel and click the Plugins menu.
|
64 |
-
5. Then activate the plugin.
|
65 |
-
6. Go to the widgets page **Appearance -> Widgets**.
|
66 |
-
7. Find **Recent Posts Extended** widget.
|
67 |
-
|
68 |
-
== Frequently Asked Questions ==
|
69 |
-
|
70 |
-
= How to filter the post query? =
|
71 |
-
You can use `rpwe_default_query_arguments` to filter it. Example:
|
72 |
-
`
|
73 |
-
add_filter( 'rpwe_default_query_arguments', 'your_custom_function' );
|
74 |
-
function your_custom_function( $args ) {
|
75 |
-
$args['posts_per_page'] = 10; // Changing the number of posts to show.
|
76 |
-
return $args;
|
77 |
-
}
|
78 |
-
`
|
79 |
-
|
80 |
-
= How to filter the post excerpt? =
|
81 |
-
Post excerpt now comes with filter to easily dev to change/customize it. `apply_filters( 'rpwe_excerpt', get_the_excerpt() )`
|
82 |
-
|
83 |
-
= Ordering not working! =
|
84 |
-
Did you installed any Post or Post Type Order? Please try to deactivate it and try again the ordering. [(related question)](http://wordpress.org/support/topic/ordering-set-to-descending-not-working)
|
85 |
-
|
86 |
-
= No image options =
|
87 |
-
Your theme needs to support Post Thumbnail, please go to http://codex.wordpress.org/Post_Thumbnails to read more info and how to activate it in your theme.
|
88 |
-
|
89 |
-
= How to add custom style? =
|
90 |
-
First, please uncheck the **Use Default Style** option then place the css code below in the Custom CSS box, then you can customize it to fit your needs
|
91 |
-
`
|
92 |
-
.rpwe-block ul {
|
93 |
-
list-style: none !important;
|
94 |
-
margin-left: 0 !important;
|
95 |
-
padding-left: 0 !important;
|
96 |
-
}
|
97 |
-
.rpwe-block li {
|
98 |
-
border-bottom: 1px solid #eee;
|
99 |
-
margin-bottom: 10px;
|
100 |
-
padding-bottom: 10px;
|
101 |
-
list-style-type: none;
|
102 |
-
}
|
103 |
-
.rpwe-block a {
|
104 |
-
display: inline !important;
|
105 |
-
text-decoration: none;
|
106 |
-
}
|
107 |
-
.rpwe-block h3 {
|
108 |
-
background: none !important;
|
109 |
-
clear: none;
|
110 |
-
margin-bottom: 0 !important;
|
111 |
-
margin-top: 0 !important;
|
112 |
-
font-weight: 400;
|
113 |
-
font-size: 12px !important;
|
114 |
-
line-height: 1.5em;
|
115 |
-
}
|
116 |
-
.rpwe-thumb {
|
117 |
-
border: 1px solid #eee !important;
|
118 |
-
box-shadow: none !important;
|
119 |
-
margin: 2px 10px 2px 0;
|
120 |
-
padding: 3px !important;
|
121 |
-
}
|
122 |
-
.rpwe-summary {
|
123 |
-
font-size: 12px;
|
124 |
-
}
|
125 |
-
.rpwe-time {
|
126 |
-
color: #bbb;
|
127 |
-
font-size: 11px;
|
128 |
-
}
|
129 |
-
.rpwe-alignleft {
|
130 |
-
display: inline;
|
131 |
-
float: left;
|
132 |
-
}
|
133 |
-
.rpwe-alignright {
|
134 |
-
display: inline;
|
135 |
-
float: right;
|
136 |
-
}
|
137 |
-
.rpwe-aligncenter {
|
138 |
-
display: block;
|
139 |
-
margin-left: auto;
|
140 |
-
margin-right: auto;
|
141 |
-
}
|
142 |
-
.rpwe-clearfix:before,.rpwe-clearfix:after {
|
143 |
-
content: "";
|
144 |
-
display: table !important;
|
145 |
-
}
|
146 |
-
.rpwe-clearfix:after {
|
147 |
-
clear: both;
|
148 |
-
}
|
149 |
-
.rpwe-clearfix {
|
150 |
-
zoom: 1;
|
151 |
-
}
|
152 |
-
`
|
153 |
-
|
154 |
-
= Why so many !important in the css code? =
|
155 |
-
I know it's not good but I have a good reason, the `!important` is to make sure the built-in style compatible with all themes. But if you don't like it, you can turn of the **Use Default Styles** and remove all custom css code in the **Custom CSS** box then create your own style.
|
156 |
-
|
157 |
-
= Available filters =
|
158 |
-
Default arguments
|
159 |
-
`
|
160 |
-
rpwe_default_args
|
161 |
-
`
|
162 |
-
|
163 |
-
Post excerpt
|
164 |
-
`
|
165 |
-
rpwe_excerpt
|
166 |
-
`
|
167 |
-
|
168 |
-
Post markup
|
169 |
-
`
|
170 |
-
rpwe_markup
|
171 |
-
`
|
172 |
-
|
173 |
-
Post query arguments
|
174 |
-
`
|
175 |
-
rpwe_default_query_arguments
|
176 |
-
`
|
177 |
-
|
178 |
-
== Screenshots ==
|
179 |
-
|
180 |
-
1. The widget settings
|
181 |
-
|
182 |
-
== Shorcode Explanation ==
|
183 |
-
|
184 |
-
Explanation of shortcode options:
|
185 |
-
|
186 |
-
Basic shortcode
|
187 |
-
`
|
188 |
-
[rpwe]
|
189 |
-
`
|
190 |
-
|
191 |
-
Display 10 recent posts
|
192 |
-
`
|
193 |
-
[rpwe limit="10"]
|
194 |
-
`
|
195 |
-
|
196 |
-
Display 10 recent posts with thumbnail
|
197 |
-
`
|
198 |
-
[rpwe limit="10" thumb="true"]
|
199 |
-
`
|
200 |
-
|
201 |
-
**Here's the full default shortcode arguments**
|
202 |
-
`
|
203 |
-
limit="5"
|
204 |
-
offset=""
|
205 |
-
order="DESC"
|
206 |
-
orderby="date"
|
207 |
-
post_type="post"
|
208 |
-
cat=""
|
209 |
-
tag=""
|
210 |
-
taxonomy=""
|
211 |
-
post_type="post"
|
212 |
-
post_status="publish"
|
213 |
-
ignore_sticky="1"
|
214 |
-
taxonomy=""
|
215 |
-
excerpt="false"
|
216 |
-
length="10"
|
217 |
-
thumb="true"
|
218 |
-
thumb_height="45"
|
219 |
-
thumb_width="45"
|
220 |
-
thumb_default="http://placehold.it/45x45/f0f0f0/ccc"
|
221 |
-
thumb_align="rpwe-alignleft"
|
222 |
-
date="true"
|
223 |
-
readmore="false"
|
224 |
-
readmore_text="Read More »"
|
225 |
-
styles_default="true"
|
226 |
-
cssID=""
|
227 |
-
before=""
|
228 |
-
after=""
|
229 |
-
`
|
230 |
-
|
231 |
-
== Changelog ==
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Recent Posts Widget Extended ===
|
2 |
+
Contributors: idenovasi, satrya
|
3 |
+
Donate link: https://paypal.me/satrya
|
4 |
+
Tags: recent posts, random posts, popular posts, thumbnails, widget, widgets, sidebar, excerpt, category, post tag, taxonomy, post type, post status, shortcode, multiple widgets
|
5 |
+
Requires at least: 5.8
|
6 |
+
Tested up to: 5.8
|
7 |
+
Requires PHP: 7.2
|
8 |
+
Stable tag: 1.1.0
|
9 |
+
License: GPLv2 or later
|
10 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
11 |
+
|
12 |
+
Provides flexible and advanced recent posts. Display it via shortcode or widget with thumbnails, post excerpt, taxonomy and more.
|
13 |
+
|
14 |
+
== Description ==
|
15 |
+
|
16 |
+
This plugin will enable a custom, flexible and super [advanced recent posts](https://idenovasi.com/projects/recent-posts-widget-extended/), you can display it via shortcode or widget. Allows you to display a list of the most recent posts with thumbnail, excerpt and post date, also you can display it from all or specific or multiple taxonomy, post type and much more!
|
17 |
+
|
18 |
+
= Features Include =
|
19 |
+
|
20 |
+
* Taxonomy support!
|
21 |
+
* Post status option.
|
22 |
+
* Custom html or text before and/or after recent posts.
|
23 |
+
* Available filter for dev.
|
24 |
+
* Shortcode feature.
|
25 |
+
* Better image cropping.
|
26 |
+
* Allow you to set title url.
|
27 |
+
* Display by date, comment count or random.
|
28 |
+
* Display thumbnails, with customizable size and alignment.
|
29 |
+
* Display excerpt, with customizable length.
|
30 |
+
* Display from all, specific or multiple category.
|
31 |
+
* Display from all, specific or multiple tag.
|
32 |
+
* Display post date.
|
33 |
+
* Display modification date
|
34 |
+
* Display comment count
|
35 |
+
* Exclude current post
|
36 |
+
* Read more option.
|
37 |
+
* Post type option.
|
38 |
+
* Custom CSS.
|
39 |
+
* Multiple widgets.
|
40 |
+
|
41 |
+
= Support this project =
|
42 |
+
|
43 |
+
* [Translate to your language](https://translate.wordpress.org/projects/wp-plugins/recent-posts-widget-extended/).
|
44 |
+
* Contribute on [Github](https://github.com/idenovasi/recent-posts-widget-extended).
|
45 |
+
* [Donate](https://paypal.me/satrya).
|
46 |
+
|
47 |
+
== Installation ==
|
48 |
+
|
49 |
+
**Through Dashboard**
|
50 |
+
|
51 |
+
1. Log in to your WordPress admin panel and go to Plugins -> Add New
|
52 |
+
2. Type **recent posts widget extended** in the search box and click on search button.
|
53 |
+
3. Find Recent Posts Widget Extended plugin.
|
54 |
+
4. Then click on Install Now after that activate the plugin.
|
55 |
+
5. Go to the widgets page **Appearance -> Widgets**.
|
56 |
+
6. Find **Recent Posts Extended** widget.
|
57 |
+
|
58 |
+
**Installing Via FTP**
|
59 |
+
|
60 |
+
1. Download the plugin to your hardisk.
|
61 |
+
2. Unzip.
|
62 |
+
3. Upload the **recent-posts-widget-extended** folder into your plugins directory.
|
63 |
+
4. Log in to your WordPress admin panel and click the Plugins menu.
|
64 |
+
5. Then activate the plugin.
|
65 |
+
6. Go to the widgets page **Appearance -> Widgets**.
|
66 |
+
7. Find **Recent Posts Extended** widget.
|
67 |
+
|
68 |
+
== Frequently Asked Questions ==
|
69 |
+
|
70 |
+
= How to filter the post query? =
|
71 |
+
You can use `rpwe_default_query_arguments` to filter it. Example:
|
72 |
+
`
|
73 |
+
add_filter( 'rpwe_default_query_arguments', 'your_custom_function' );
|
74 |
+
function your_custom_function( $args ) {
|
75 |
+
$args['posts_per_page'] = 10; // Changing the number of posts to show.
|
76 |
+
return $args;
|
77 |
+
}
|
78 |
+
`
|
79 |
+
|
80 |
+
= How to filter the post excerpt? =
|
81 |
+
Post excerpt now comes with filter to easily dev to change/customize it. `apply_filters( 'rpwe_excerpt', get_the_excerpt() )`
|
82 |
+
|
83 |
+
= Ordering not working! =
|
84 |
+
Did you installed any Post or Post Type Order? Please try to deactivate it and try again the ordering. [(related question)](http://wordpress.org/support/topic/ordering-set-to-descending-not-working)
|
85 |
+
|
86 |
+
= No image options =
|
87 |
+
Your theme needs to support Post Thumbnail, please go to http://codex.wordpress.org/Post_Thumbnails to read more info and how to activate it in your theme.
|
88 |
+
|
89 |
+
= How to add custom style? =
|
90 |
+
First, please uncheck the **Use Default Style** option then place the css code below in the Custom CSS box, then you can customize it to fit your needs
|
91 |
+
`
|
92 |
+
.rpwe-block ul {
|
93 |
+
list-style: none !important;
|
94 |
+
margin-left: 0 !important;
|
95 |
+
padding-left: 0 !important;
|
96 |
+
}
|
97 |
+
.rpwe-block li {
|
98 |
+
border-bottom: 1px solid #eee;
|
99 |
+
margin-bottom: 10px;
|
100 |
+
padding-bottom: 10px;
|
101 |
+
list-style-type: none;
|
102 |
+
}
|
103 |
+
.rpwe-block a {
|
104 |
+
display: inline !important;
|
105 |
+
text-decoration: none;
|
106 |
+
}
|
107 |
+
.rpwe-block h3 {
|
108 |
+
background: none !important;
|
109 |
+
clear: none;
|
110 |
+
margin-bottom: 0 !important;
|
111 |
+
margin-top: 0 !important;
|
112 |
+
font-weight: 400;
|
113 |
+
font-size: 12px !important;
|
114 |
+
line-height: 1.5em;
|
115 |
+
}
|
116 |
+
.rpwe-thumb {
|
117 |
+
border: 1px solid #eee !important;
|
118 |
+
box-shadow: none !important;
|
119 |
+
margin: 2px 10px 2px 0;
|
120 |
+
padding: 3px !important;
|
121 |
+
}
|
122 |
+
.rpwe-summary {
|
123 |
+
font-size: 12px;
|
124 |
+
}
|
125 |
+
.rpwe-time {
|
126 |
+
color: #bbb;
|
127 |
+
font-size: 11px;
|
128 |
+
}
|
129 |
+
.rpwe-alignleft {
|
130 |
+
display: inline;
|
131 |
+
float: left;
|
132 |
+
}
|
133 |
+
.rpwe-alignright {
|
134 |
+
display: inline;
|
135 |
+
float: right;
|
136 |
+
}
|
137 |
+
.rpwe-aligncenter {
|
138 |
+
display: block;
|
139 |
+
margin-left: auto;
|
140 |
+
margin-right: auto;
|
141 |
+
}
|
142 |
+
.rpwe-clearfix:before,.rpwe-clearfix:after {
|
143 |
+
content: "";
|
144 |
+
display: table !important;
|
145 |
+
}
|
146 |
+
.rpwe-clearfix:after {
|
147 |
+
clear: both;
|
148 |
+
}
|
149 |
+
.rpwe-clearfix {
|
150 |
+
zoom: 1;
|
151 |
+
}
|
152 |
+
`
|
153 |
+
|
154 |
+
= Why so many !important in the css code? =
|
155 |
+
I know it's not good but I have a good reason, the `!important` is to make sure the built-in style compatible with all themes. But if you don't like it, you can turn of the **Use Default Styles** and remove all custom css code in the **Custom CSS** box then create your own style.
|
156 |
+
|
157 |
+
= Available filters =
|
158 |
+
Default arguments
|
159 |
+
`
|
160 |
+
rpwe_default_args
|
161 |
+
`
|
162 |
+
|
163 |
+
Post excerpt
|
164 |
+
`
|
165 |
+
rpwe_excerpt
|
166 |
+
`
|
167 |
+
|
168 |
+
Post markup
|
169 |
+
`
|
170 |
+
rpwe_markup
|
171 |
+
`
|
172 |
+
|
173 |
+
Post query arguments
|
174 |
+
`
|
175 |
+
rpwe_default_query_arguments
|
176 |
+
`
|
177 |
+
|
178 |
+
== Screenshots ==
|
179 |
+
|
180 |
+
1. The widget settings
|
181 |
+
|
182 |
+
== Shorcode Explanation ==
|
183 |
+
|
184 |
+
Explanation of shortcode options:
|
185 |
+
|
186 |
+
Basic shortcode
|
187 |
+
`
|
188 |
+
[rpwe]
|
189 |
+
`
|
190 |
+
|
191 |
+
Display 10 recent posts
|
192 |
+
`
|
193 |
+
[rpwe limit="10"]
|
194 |
+
`
|
195 |
+
|
196 |
+
Display 10 recent posts with thumbnail
|
197 |
+
`
|
198 |
+
[rpwe limit="10" thumb="true"]
|
199 |
+
`
|
200 |
+
|
201 |
+
**Here's the full default shortcode arguments**
|
202 |
+
`
|
203 |
+
limit="5"
|
204 |
+
offset=""
|
205 |
+
order="DESC"
|
206 |
+
orderby="date"
|
207 |
+
post_type="post"
|
208 |
+
cat=""
|
209 |
+
tag=""
|
210 |
+
taxonomy=""
|
211 |
+
post_type="post"
|
212 |
+
post_status="publish"
|
213 |
+
ignore_sticky="1"
|
214 |
+
taxonomy=""
|
215 |
+
excerpt="false"
|
216 |
+
length="10"
|
217 |
+
thumb="true"
|
218 |
+
thumb_height="45"
|
219 |
+
thumb_width="45"
|
220 |
+
thumb_default="http://placehold.it/45x45/f0f0f0/ccc"
|
221 |
+
thumb_align="rpwe-alignleft"
|
222 |
+
date="true"
|
223 |
+
readmore="false"
|
224 |
+
readmore_text="Read More »"
|
225 |
+
styles_default="true"
|
226 |
+
cssID=""
|
227 |
+
before=""
|
228 |
+
after=""
|
229 |
+
`
|
230 |
+
|
231 |
+
== Changelog ==
|
232 |
+
|
233 |
+
**1.1.0**
|
234 |
+
|
235 |
+
Release Date: Oct 25, 2021
|
236 |
+
|
237 |
+
This release comes with several fixes and enhancements to support the new Widget Block in WordPress 5.8.
|
238 |
+
|
239 |
+
**Enhancements:**
|
240 |
+
|
241 |
+
- Adds `height` and `width` attribute to the image thumbnail.
|
242 |
+
|
243 |
+
**Bugfixes:**
|
244 |
+
|
245 |
+
- Fixes a bug the widget couldn't load on new Widgets Block page.
|
246 |
+
|
247 |
+
**Warning:**
|
248 |
+
|
249 |
+
Current thumbnail resize system will be deprecated and replaced with WordPress built-in thumbnail resize function.
|
250 |
+
|
251 |
+
|
252 |
+
|
rpwe.php
CHANGED
@@ -1,136 +1,123 @@
|
|
1 |
-
<?php
|
2 |
-
|
3 |
-
/**
|
4 |
-
* Plugin Name:
|
5 |
-
* Plugin URI:
|
6 |
-
* Description:
|
7 |
-
* Version:
|
8 |
-
*
|
9 |
-
*
|
10 |
-
* Author
|
11 |
-
*
|
12 |
-
*
|
13 |
-
*
|
14 |
-
*
|
15 |
-
*
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
*
|
96 |
-
*
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
}
|
125 |
-
|
126 |
-
/**
|
127 |
-
* Register new image size.
|
128 |
-
*
|
129 |
-
* @since 0.9.4
|
130 |
-
*/
|
131 |
-
function register_image_size() {
|
132 |
-
add_image_size('rpwe-thumbnail', 45, 45, true);
|
133 |
-
}
|
134 |
-
}
|
135 |
-
|
136 |
-
new RPW_Extended;
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/**
|
4 |
+
* Plugin Name: Recent Posts Widget Extended
|
5 |
+
* Plugin URI: https://idenovasi.com/projects/recent-posts-widget-extended/
|
6 |
+
* Description: Enables advanced widget that gives you total control over the output of your site’s most recent Posts.
|
7 |
+
* Version: 1.1.0
|
8 |
+
* Requires at least: 5.8
|
9 |
+
* Requires PHP: 7.2
|
10 |
+
* Author: Idenovasi
|
11 |
+
* Author URI: https://idenovasi.com/
|
12 |
+
* License: GPL v2 or later
|
13 |
+
* License URI: https://www.gnu.org/licenses/gpl-2.0.html
|
14 |
+
* Text Domain: recent-posts-widget-extended
|
15 |
+
* Domain Path: /languages
|
16 |
+
*/
|
17 |
+
|
18 |
+
// Exit if accessed directly
|
19 |
+
if (!defined('ABSPATH')) exit;
|
20 |
+
|
21 |
+
class RPW_Extended {
|
22 |
+
|
23 |
+
/**
|
24 |
+
* PHP5 constructor method.
|
25 |
+
*
|
26 |
+
* @since 0.1
|
27 |
+
*/
|
28 |
+
public function __construct() {
|
29 |
+
|
30 |
+
// Set the constants needed by the plugin.
|
31 |
+
add_action('plugins_loaded', array(&$this, 'constants'), 1);
|
32 |
+
|
33 |
+
// Internationalize the text strings used.
|
34 |
+
add_action('plugins_loaded', array(&$this, 'i18n'), 2);
|
35 |
+
|
36 |
+
// Load the functions files.
|
37 |
+
add_action('plugins_loaded', array(&$this, 'includes'), 3);
|
38 |
+
|
39 |
+
// Load the admin style.
|
40 |
+
add_action('admin_enqueue_scripts', array(&$this, 'admin_style'));
|
41 |
+
|
42 |
+
// Register widget.
|
43 |
+
add_action('widgets_init', array(&$this, 'register_widget'));
|
44 |
+
|
45 |
+
// Register new image size.
|
46 |
+
add_action('init', array(&$this, 'register_image_size'));
|
47 |
+
}
|
48 |
+
|
49 |
+
/**
|
50 |
+
* Defines constants used by the plugin.
|
51 |
+
*
|
52 |
+
* @since 0.1
|
53 |
+
*/
|
54 |
+
public function constants() {
|
55 |
+
|
56 |
+
// Set constant path to the plugin directory.
|
57 |
+
define('RPWE_DIR', trailingslashit(plugin_dir_path(__FILE__)));
|
58 |
+
|
59 |
+
// Set the constant path to the plugin directory URI.
|
60 |
+
define('RPWE_URI', trailingslashit(plugin_dir_url(__FILE__)));
|
61 |
+
|
62 |
+
// Set the constant path to the includes directory.
|
63 |
+
define('RPWE_INCLUDES', RPWE_DIR . trailingslashit('includes'));
|
64 |
+
|
65 |
+
// Set the constant path to the includes directory.
|
66 |
+
define('RPWE_CLASS', RPWE_DIR . trailingslashit('classes'));
|
67 |
+
|
68 |
+
// Set the constant path to the assets directory.
|
69 |
+
define('RPWE_ASSETS', RPWE_URI . trailingslashit('assets'));
|
70 |
+
}
|
71 |
+
|
72 |
+
/**
|
73 |
+
* Loads the translation files.
|
74 |
+
*
|
75 |
+
* @since 0.1
|
76 |
+
*/
|
77 |
+
public function i18n() {
|
78 |
+
load_plugin_textdomain('recent-posts-widget-extended', false, dirname(plugin_basename(__FILE__)) . '/languages/');
|
79 |
+
}
|
80 |
+
|
81 |
+
/**
|
82 |
+
* Loads the initial files needed by the plugin.
|
83 |
+
*
|
84 |
+
* @since 0.1
|
85 |
+
*/
|
86 |
+
public function includes() {
|
87 |
+
require_once(RPWE_INCLUDES . 'resizer.php');
|
88 |
+
require_once(RPWE_INCLUDES . 'functions.php');
|
89 |
+
require_once(RPWE_INCLUDES . 'shortcode.php');
|
90 |
+
require_once(RPWE_INCLUDES . 'helpers.php');
|
91 |
+
}
|
92 |
+
|
93 |
+
/**
|
94 |
+
* Register custom style for the widget settings.
|
95 |
+
*
|
96 |
+
* @since 0.8
|
97 |
+
*/
|
98 |
+
public function admin_style() {
|
99 |
+
// Loads the widget style.
|
100 |
+
wp_enqueue_style('rpwe-admin-style', trailingslashit(RPWE_ASSETS) . 'css/rpwe-admin.css', null, null);
|
101 |
+
}
|
102 |
+
|
103 |
+
/**
|
104 |
+
* Register the widget.
|
105 |
+
*
|
106 |
+
* @since 0.9.1
|
107 |
+
*/
|
108 |
+
public function register_widget() {
|
109 |
+
require_once(RPWE_CLASS . 'widget.php');
|
110 |
+
register_widget('Recent_Posts_Widget_Extended');
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
* Register new image size.
|
115 |
+
*
|
116 |
+
* @since 0.9.4
|
117 |
+
*/
|
118 |
+
function register_image_size() {
|
119 |
+
add_image_size('rpwe-thumbnail', 45, 45, true);
|
120 |
+
}
|
121 |
+
}
|
122 |
+
|
123 |
+
new RPW_Extended;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
screenshot-1.png
DELETED
Binary file
|