Version Description
PLEASE RE-SAVE THE WIDGET * Added setting for cache life * Added input for CSS class (used for custom styling) * Fix the inline issue on some themes * Update language
Download this release
Release Info
Developer | satrya |
Plugin | Recent Posts Widget Extended |
Version | 0.7.1 |
Comparing to | |
See all releases |
Code changes from version 0.7 to 0.7.1
- includes/widget-recent-posts-extended.php +146 -117
- languages/rpwe.mo +0 -0
- languages/rpwe.po +32 -24
- readme.txt +14 -6
- rpwe.css +3 -2
- rpwe.php +2 -2
includes/widget-recent-posts-extended.php
CHANGED
@@ -1,108 +1,117 @@
|
|
1 |
<?php
|
2 |
|
3 |
// Exit if accessed directly
|
4 |
-
if (
|
5 |
|
6 |
-
class rpwe_widget extends WP_Widget
|
|
|
7 |
|
8 |
/**
|
9 |
* Widget setup
|
10 |
*/
|
11 |
-
function rpwe_widget()
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
'
|
|
|
16 |
);
|
17 |
|
18 |
-
$control_ops = array(
|
19 |
-
'width' => 300,
|
20 |
-
'height' => 350,
|
21 |
-
'id_base' => 'rpwe_widget'
|
22 |
);
|
23 |
|
24 |
-
$this->WP_Widget(
|
25 |
|
26 |
}
|
27 |
|
28 |
/**
|
29 |
* Display widget
|
30 |
*/
|
31 |
-
function widget(
|
32 |
-
|
33 |
-
|
34 |
-
|
|
|
|
|
|
|
35 |
$limit = $instance['limit'];
|
36 |
$excerpt = $instance['excerpt'];
|
37 |
-
$length = (int)(
|
38 |
$thumb = $instance['thumb'];
|
39 |
-
$thumb_height = (int)(
|
40 |
-
$thumb_width = (int)(
|
41 |
$cat = $instance['cat'];
|
42 |
$post_type = $instance['post_type'];
|
43 |
$date = $instance['date'];
|
44 |
-
$css = wp_filter_nohtml_kses(
|
45 |
|
46 |
echo $before_widget;
|
47 |
|
48 |
-
if(
|
49 |
-
|
50 |
-
|
51 |
-
if (
|
52 |
echo $before_title . $title . $after_title;
|
53 |
-
|
54 |
global $post;
|
55 |
|
56 |
-
if (
|
57 |
|
58 |
-
$args = array(
|
59 |
'numberposts' => $limit,
|
60 |
'cat' => $cat,
|
61 |
'post_type' => $post_type
|
62 |
);
|
63 |
|
64 |
-
|
|
|
|
|
|
|
65 |
|
66 |
-
|
67 |
|
68 |
} ?>
|
69 |
|
70 |
-
<div class="rpwe-block">
|
71 |
-
|
72 |
-
<ul>
|
73 |
|
74 |
-
|
|
|
|
|
75 |
|
76 |
<li class="rpwe-clearfix">
|
77 |
|
78 |
-
<?php if(
|
79 |
-
|
80 |
-
<a href="<?php the_permalink(); ?>" title="<?php printf(
|
81 |
<?php
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
?>
|
87 |
</a>
|
88 |
|
89 |
<?php } ?>
|
90 |
|
91 |
<h3 class="rpwe-title">
|
92 |
-
<a href="<?php the_permalink(); ?>" title="<?php printf(
|
93 |
</h3>
|
94 |
|
95 |
-
<?php if(
|
96 |
-
<span class="rpwe-time"><?php echo human_time_diff(
|
97 |
<?php } ?>
|
98 |
|
99 |
-
<?php if(
|
100 |
-
<div class="rpwe-summary"><?php echo rpwe_excerpt(
|
101 |
<?php } ?>
|
102 |
|
103 |
</li>
|
104 |
|
105 |
-
<?php endforeach;
|
|
|
106 |
|
107 |
</ul>
|
108 |
|
@@ -111,28 +120,31 @@ class rpwe_widget extends WP_Widget {
|
|
111 |
<?php
|
112 |
|
113 |
echo $after_widget;
|
114 |
-
|
115 |
}
|
116 |
|
117 |
/**
|
118 |
* Update widget
|
119 |
*/
|
120 |
-
function update(
|
|
|
121 |
|
122 |
$instance = $old_instance;
|
123 |
-
$instance['title'] = esc_attr(
|
|
|
|
|
124 |
$instance['limit'] = $new_instance['limit'];
|
125 |
$instance['excerpt'] = $new_instance['excerpt'];
|
126 |
-
$instance['length'] = (int)(
|
127 |
$instance['thumb'] = $new_instance['thumb'];
|
128 |
-
$instance['thumb_height'] = (int)(
|
129 |
-
$instance['thumb_width'] = (int)(
|
130 |
$instance['cat'] = $new_instance['cat'];
|
131 |
$instance['post_type'] = $new_instance['post_type'];
|
132 |
$instance['date'] = $new_instance['date'];
|
133 |
-
$instance['css'] = wp_filter_nohtml_kses(
|
134 |
|
135 |
-
delete_transient(
|
136 |
|
137 |
return $instance;
|
138 |
|
@@ -141,93 +153,106 @@ class rpwe_widget extends WP_Widget {
|
|
141 |
/**
|
142 |
* Widget setting
|
143 |
*/
|
144 |
-
function form(
|
|
|
145 |
|
146 |
/* Set up some default widget settings. */
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
|
|
|
|
|
|
|
|
163 |
$limit = $instance['limit'];
|
164 |
$excerpt = $instance['excerpt'];
|
165 |
$length = (int)($instance['length']);
|
166 |
$thumb = $instance['thumb'];
|
167 |
-
$thumb_height = (int)(
|
168 |
-
$thumb_width = (int)(
|
169 |
$cat = $instance['cat'];
|
170 |
$post_type = $instance['post_type'];
|
171 |
$date = $instance['date'];
|
172 |
-
$css = wp_filter_nohtml_kses(
|
173 |
|
174 |
-
|
175 |
|
176 |
<p>
|
177 |
-
<label for="<?php echo esc_attr(
|
178 |
-
<input class="widefat" id="<?php echo esc_attr(
|
179 |
</p>
|
180 |
<p>
|
181 |
-
<label for="<?php echo esc_attr(
|
182 |
-
<
|
183 |
-
|
184 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
185 |
<?php } ?>
|
186 |
</select>
|
187 |
</p>
|
188 |
<p>
|
189 |
-
<label for="<?php echo esc_attr(
|
190 |
-
|
191 |
-
|
|
|
|
|
|
|
|
|
192 |
<p>
|
193 |
-
<label for="<?php echo esc_attr(
|
194 |
-
|
195 |
-
</p>
|
196 |
-
<p>
|
197 |
-
<label for="<?php echo esc_attr( $this->get_field_id( 'length' ) ); ?>"><?php _e( 'Excerpt length:', 'rpwe' ); ?></label>
|
198 |
-
<input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'length' ) ); ?>" name="<?php echo esc_attr( $this->get_field_name( 'length' ) ); ?>" type="text" value="<?php echo $length; ?>" />
|
199 |
</p>
|
200 |
|
201 |
-
<?php if(
|
202 |
|
203 |
<p>
|
204 |
-
<label for="<?php echo esc_attr(
|
205 |
-
|
206 |
-
|
207 |
-
|
208 |
-
<label for="<?php echo esc_attr(
|
209 |
-
<input id="<?php echo esc_attr(
|
210 |
-
<input id="<?php echo esc_attr(
|
211 |
</p>
|
212 |
|
213 |
<?php } ?>
|
214 |
|
215 |
<p>
|
216 |
-
<label for="<?php echo esc_attr(
|
217 |
-
<?php wp_dropdown_categories(
|
218 |
</p>
|
219 |
<p>
|
220 |
-
<label for="<?php echo esc_attr(
|
221 |
<?php /* pros Justin Tadlock - http://themehybrid.com/ */ ?>
|
222 |
-
<select class="widefat" id="<?php echo $this->get_field_id(
|
223 |
-
<?php foreach (
|
224 |
-
<option value="<?php echo esc_attr(
|
225 |
<?php } ?>
|
226 |
</select>
|
227 |
</p>
|
228 |
<p>
|
229 |
-
<label for="<?php echo $this->get_field_id(
|
230 |
-
<textarea class="widefat" id="<?php echo $this->get_field_id(
|
231 |
</p>
|
232 |
<p>
|
233 |
<span style="color: #f00;">Recent Posts Widget Extended is a project by <a href="http://tokokoo.com" target="_blank">Tokokoo</a></span>
|
@@ -243,10 +268,12 @@ class rpwe_widget extends WP_Widget {
|
|
243 |
*
|
244 |
* @since 0.1
|
245 |
*/
|
246 |
-
function rpwe_register_widget()
|
247 |
-
|
|
|
248 |
}
|
249 |
-
|
|
|
250 |
|
251 |
/**
|
252 |
* Print a custom excerpt.
|
@@ -254,18 +281,20 @@ add_action( 'widgets_init', 'rpwe_register_widget' );
|
|
254 |
*
|
255 |
* @since 0.1
|
256 |
*/
|
257 |
-
function rpwe_excerpt(
|
|
|
258 |
|
259 |
-
$excerpt = explode(
|
260 |
-
if (
|
261 |
-
array_pop(
|
262 |
-
$excerpt = implode(
|
263 |
} else {
|
264 |
-
$excerpt = implode(
|
265 |
-
}
|
266 |
-
|
267 |
|
268 |
return $excerpt;
|
269 |
|
270 |
}
|
|
|
271 |
?>
|
1 |
<?php
|
2 |
|
3 |
// Exit if accessed directly
|
4 |
+
if (!defined('ABSPATH')) exit;
|
5 |
|
6 |
+
class rpwe_widget extends WP_Widget
|
7 |
+
{
|
8 |
|
9 |
/**
|
10 |
* Widget setup
|
11 |
*/
|
12 |
+
function rpwe_widget()
|
13 |
+
{
|
14 |
+
|
15 |
+
$widget_ops = array(
|
16 |
+
'classname' => 'rpwe_widget recent-posts-extended',
|
17 |
+
'description' => __('Advanced recent posts widget.', 'rpwe')
|
18 |
);
|
19 |
|
20 |
+
$control_ops = array(
|
21 |
+
'width' => 300,
|
22 |
+
'height' => 350,
|
23 |
+
'id_base' => 'rpwe_widget'
|
24 |
);
|
25 |
|
26 |
+
$this->WP_Widget('rpwe_widget', __('» Recent Posts Widget Extended', 'rpwe'), $widget_ops, $control_ops);
|
27 |
|
28 |
}
|
29 |
|
30 |
/**
|
31 |
* Display widget
|
32 |
*/
|
33 |
+
function widget($args, $instance)
|
34 |
+
{
|
35 |
+
extract($args, EXTR_SKIP);
|
36 |
+
|
37 |
+
$title = apply_filters('widget_title', $instance['title']);
|
38 |
+
$cssID = $instance['cssID'];
|
39 |
+
$cacheLife = (int)($instance['cacheLife']);
|
40 |
$limit = $instance['limit'];
|
41 |
$excerpt = $instance['excerpt'];
|
42 |
+
$length = (int)($instance['length']);
|
43 |
$thumb = $instance['thumb'];
|
44 |
+
$thumb_height = (int)($instance['thumb_height']);
|
45 |
+
$thumb_width = (int)($instance['thumb_width']);
|
46 |
$cat = $instance['cat'];
|
47 |
$post_type = $instance['post_type'];
|
48 |
$date = $instance['date'];
|
49 |
+
$css = wp_filter_nohtml_kses($instance['css']);
|
50 |
|
51 |
echo $before_widget;
|
52 |
|
53 |
+
if ($css)
|
54 |
+
echo '<style>' . $css . '</style>';
|
55 |
+
|
56 |
+
if (!empty($title))
|
57 |
echo $before_title . $title . $after_title;
|
58 |
+
|
59 |
global $post;
|
60 |
|
61 |
+
if (false === ($rpwewidget = get_transient('rpwewidget_' . $widget_id))) {
|
62 |
|
63 |
+
$args = array(
|
64 |
'numberposts' => $limit,
|
65 |
'cat' => $cat,
|
66 |
'post_type' => $post_type
|
67 |
);
|
68 |
|
69 |
+
$rpwewidget = get_posts($args);
|
70 |
+
|
71 |
+
//by default, cache for 12 hours
|
72 |
+
$cachelife = (is_numeric($cacheLife) ? $cacheLife : 43200);
|
73 |
|
74 |
+
set_transient('rpwewidget_' . $widget_id, $rpwewidget, $cacheLife);
|
75 |
|
76 |
} ?>
|
77 |
|
78 |
+
<div <?php echo(!empty($cssID) ? 'id="' . $cssID . '"' : ''); ?> class="rpwe-block">
|
|
|
|
|
79 |
|
80 |
+
<ul class="rpwe-ul">
|
81 |
+
|
82 |
+
<?php foreach ($rpwewidget as $post) : setup_postdata($post); ?>
|
83 |
|
84 |
<li class="rpwe-clearfix">
|
85 |
|
86 |
+
<?php if (has_post_thumbnail() && $thumb == true) { ?>
|
87 |
+
|
88 |
+
<a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__('Permalink to %s', 'rpwe'), the_title_attribute('echo=0')); ?>" rel="bookmark">
|
89 |
<?php
|
90 |
+
if (current_theme_supports('get-the-image'))
|
91 |
+
get_the_image(array('meta_key' => 'Thumbnail', 'height' => $thumb_height, 'width' => $thumb_width, 'image_class' => 'rpwe-alignleft', 'link_to_post' => false));
|
92 |
+
else
|
93 |
+
the_post_thumbnail(array($thumb_height, $thumb_width), array('class' => 'rpwe-alignleft', 'alt' => esc_attr(get_the_title()), 'title' => esc_attr(get_the_title())));
|
94 |
?>
|
95 |
</a>
|
96 |
|
97 |
<?php } ?>
|
98 |
|
99 |
<h3 class="rpwe-title">
|
100 |
+
<a href="<?php the_permalink(); ?>" title="<?php printf(esc_attr__('Permalink to %s', 'rpwe'), the_title_attribute('echo=0')); ?>" rel="bookmark"><?php the_title(); ?></a>
|
101 |
</h3>
|
102 |
|
103 |
+
<?php if ($date == true) { ?>
|
104 |
+
<span class="rpwe-time"><?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . __(' ago', 'rpwe'); ?></span>
|
105 |
<?php } ?>
|
106 |
|
107 |
+
<?php if ($excerpt == true) { ?>
|
108 |
+
<div class="rpwe-summary"><?php echo rpwe_excerpt($length); ?></div>
|
109 |
<?php } ?>
|
110 |
|
111 |
</li>
|
112 |
|
113 |
+
<?php endforeach;
|
114 |
+
wp_reset_postdata(); ?>
|
115 |
|
116 |
</ul>
|
117 |
|
120 |
<?php
|
121 |
|
122 |
echo $after_widget;
|
123 |
+
|
124 |
}
|
125 |
|
126 |
/**
|
127 |
* Update widget
|
128 |
*/
|
129 |
+
function update($new_instance, $old_instance)
|
130 |
+
{
|
131 |
|
132 |
$instance = $old_instance;
|
133 |
+
$instance['title'] = esc_attr($new_instance['title']);
|
134 |
+
$instance['cssID'] = $new_instance['cssID'];
|
135 |
+
$instance['cacheLife'] = $new_instance['cacheLife'];
|
136 |
$instance['limit'] = $new_instance['limit'];
|
137 |
$instance['excerpt'] = $new_instance['excerpt'];
|
138 |
+
$instance['length'] = (int)($new_instance['length']);
|
139 |
$instance['thumb'] = $new_instance['thumb'];
|
140 |
+
$instance['thumb_height'] = (int)($new_instance['thumb_height']);
|
141 |
+
$instance['thumb_width'] = (int)($new_instance['thumb_width']);
|
142 |
$instance['cat'] = $new_instance['cat'];
|
143 |
$instance['post_type'] = $new_instance['post_type'];
|
144 |
$instance['date'] = $new_instance['date'];
|
145 |
+
$instance['css'] = wp_filter_nohtml_kses($new_instance['css']);
|
146 |
|
147 |
+
delete_transient('rpwewidget_' . $this->id);
|
148 |
|
149 |
return $instance;
|
150 |
|
153 |
/**
|
154 |
* Widget setting
|
155 |
*/
|
156 |
+
function form($instance)
|
157 |
+
{
|
158 |
|
159 |
/* Set up some default widget settings. */
|
160 |
+
$defaults = array(
|
161 |
+
'title' => '',
|
162 |
+
'cssID' => '',
|
163 |
+
'cacheLife' => 43200,
|
164 |
+
'limit' => 5,
|
165 |
+
'excerpt' => '',
|
166 |
+
'length' => 10,
|
167 |
+
'thumb' => true,
|
168 |
+
'thumb_height' => 45,
|
169 |
+
'thumb_width' => 45,
|
170 |
+
'cat' => '',
|
171 |
+
'post_type' => '',
|
172 |
+
'date' => true,
|
173 |
+
'css' => ''
|
174 |
+
);
|
175 |
+
|
176 |
+
$instance = wp_parse_args((array)$instance, $defaults);
|
177 |
+
$title = esc_attr($instance['title']);
|
178 |
+
$cssID = $instance['cssID'];
|
179 |
+
$cacheLife = (int)($instance['cacheLife']);
|
180 |
$limit = $instance['limit'];
|
181 |
$excerpt = $instance['excerpt'];
|
182 |
$length = (int)($instance['length']);
|
183 |
$thumb = $instance['thumb'];
|
184 |
+
$thumb_height = (int)($instance['thumb_height']);
|
185 |
+
$thumb_width = (int)($instance['thumb_width']);
|
186 |
$cat = $instance['cat'];
|
187 |
$post_type = $instance['post_type'];
|
188 |
$date = $instance['date'];
|
189 |
+
$css = wp_filter_nohtml_kses($instance['css']);
|
190 |
|
191 |
+
?>
|
192 |
|
193 |
<p>
|
194 |
+
<label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php _e('Title:', 'rpwe'); ?></label>
|
195 |
+
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo $title; ?>"/>
|
196 |
</p>
|
197 |
<p>
|
198 |
+
<label for="<?php echo esc_attr($this->get_field_id('cssID')); ?>"><?php _e('Widget CSS ID: (no spaces or special characters)', 'rpwe'); ?></label>
|
199 |
+
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('cssID')); ?>" name="<?php echo esc_attr($this->get_field_name('cssID')); ?>" type="text" value="<?php echo $cssID; ?>"/>
|
200 |
+
</p>
|
201 |
+
<p>
|
202 |
+
<label for="<?php echo esc_attr($this->get_field_id('cacheLife')); ?>"><?php _e('Cache Life: (in seconds. Default is 43200, 1 to disable)', 'rpwe'); ?></label>
|
203 |
+
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('cacheLife')); ?>" name="<?php echo esc_attr($this->get_field_name('cacheLife')); ?>" type="text" value="<?php echo $cacheLife; ?>"/>
|
204 |
+
</p>
|
205 |
+
<p>
|
206 |
+
<label for="<?php echo esc_attr($this->get_field_id('limit')); ?>"><?php _e('Limit:', 'rpwe'); ?></label>
|
207 |
+
<select class="widefat" name="<?php echo $this->get_field_name('limit'); ?>" id="<?php echo $this->get_field_id('limit'); ?>">
|
208 |
+
<?php for ($i = 1; $i <= 20; $i++) { ?>
|
209 |
+
<option <?php selected($limit, $i) ?> value="<?php echo $i; ?>"><?php echo $i; ?></option>
|
210 |
<?php } ?>
|
211 |
</select>
|
212 |
</p>
|
213 |
<p>
|
214 |
+
<label for="<?php echo esc_attr($this->get_field_id('date')); ?>"><?php _e('Display Date?', 'rpwe'); ?></label>
|
215 |
+
<input id="<?php echo $this->get_field_id('date'); ?>" name="<?php echo $this->get_field_name('date'); ?>" type="checkbox" value="1" <?php checked('1', $date); ?> />
|
216 |
+
</p>
|
217 |
+
<p>
|
218 |
+
<label for="<?php echo esc_attr($this->get_field_id('excerpt')); ?>"><?php _e('Display Excerpt?', 'rpwe'); ?></label>
|
219 |
+
<input id="<?php echo $this->get_field_id('excerpt'); ?>" name="<?php echo $this->get_field_name('excerpt'); ?>" type="checkbox" value="1" <?php checked('1', $excerpt); ?> />
|
220 |
+
</p>
|
221 |
<p>
|
222 |
+
<label for="<?php echo esc_attr($this->get_field_id('length')); ?>"><?php _e('Excerpt Length:', 'rpwe'); ?></label>
|
223 |
+
<input class="widefat" id="<?php echo esc_attr($this->get_field_id('length')); ?>" name="<?php echo esc_attr($this->get_field_name('length')); ?>" type="text" value="<?php echo $length; ?>"/>
|
|
|
|
|
|
|
|
|
224 |
</p>
|
225 |
|
226 |
+
<?php if (current_theme_supports('post-thumbnails')) { ?>
|
227 |
|
228 |
<p>
|
229 |
+
<label for="<?php echo esc_attr($this->get_field_id('thumb')); ?>"><?php _e('Display Thumbnail?', 'rpwe'); ?></label>
|
230 |
+
<input id="<?php echo $this->get_field_id('thumb'); ?>" name="<?php echo $this->get_field_name('thumb'); ?>" type="checkbox" value="1" <?php checked('1', $thumb); ?> />
|
231 |
+
</p>
|
232 |
+
<p>
|
233 |
+
<label for="<?php echo esc_attr($this->get_field_id('thumb_height')); ?>"><?php _e('Thumbnail Size (height x width):', 'rpwe'); ?></label>
|
234 |
+
<input id="<?php echo esc_attr($this->get_field_id('thumb_height')); ?>" name="<?php echo esc_attr($this->get_field_name('thumb_height')); ?>" type="text" value="<?php echo $thumb_height; ?>"/>
|
235 |
+
<input id="<?php echo esc_attr($this->get_field_id('thumb_width')); ?>" name="<?php echo esc_attr($this->get_field_name('thumb_width')); ?>" type="text" value="<?php echo $thumb_width; ?>"/>
|
236 |
</p>
|
237 |
|
238 |
<?php } ?>
|
239 |
|
240 |
<p>
|
241 |
+
<label for="<?php echo esc_attr($this->get_field_id('cat')); ?>"><?php _e('Limit to Category: ', 'rpwe'); ?></label>
|
242 |
+
<?php wp_dropdown_categories(array('name' => $this->get_field_name('cat'), 'show_option_all' => __('All categories', 'rpwe'), 'hide_empty' => 1, 'hierarchical' => 1, 'selected' => $cat)); ?>
|
243 |
</p>
|
244 |
<p>
|
245 |
+
<label for="<?php echo esc_attr($this->get_field_id('post_type')); ?>"><?php _e('Choose the Post Type: ', 'rpwe'); ?></label>
|
246 |
<?php /* pros Justin Tadlock - http://themehybrid.com/ */ ?>
|
247 |
+
<select class="widefat" id="<?php echo $this->get_field_id('post_type'); ?>" name="<?php echo $this->get_field_name('post_type'); ?>">
|
248 |
+
<?php foreach (get_post_types('', 'objects') as $post_type) { ?>
|
249 |
+
<option value="<?php echo esc_attr($post_type->name); ?>" <?php selected($instance['post_type'], $post_type->name); ?>><?php echo esc_html($post_type->labels->singular_name); ?></option>
|
250 |
<?php } ?>
|
251 |
</select>
|
252 |
</p>
|
253 |
<p>
|
254 |
+
<label for="<?php echo $this->get_field_id('css'); ?>"><?php _e('Custom CSS:', 'rpwe'); ?></label>
|
255 |
+
<textarea class="widefat" id="<?php echo $this->get_field_id('css'); ?>" name="<?php echo $this->get_field_name('css'); ?>" style="height:100px;"><?php echo $css; ?></textarea>
|
256 |
</p>
|
257 |
<p>
|
258 |
<span style="color: #f00;">Recent Posts Widget Extended is a project by <a href="http://tokokoo.com" target="_blank">Tokokoo</a></span>
|
268 |
*
|
269 |
* @since 0.1
|
270 |
*/
|
271 |
+
function rpwe_register_widget()
|
272 |
+
{
|
273 |
+
register_widget('rpwe_widget');
|
274 |
}
|
275 |
+
|
276 |
+
add_action('widgets_init', 'rpwe_register_widget');
|
277 |
|
278 |
/**
|
279 |
* Print a custom excerpt.
|
281 |
*
|
282 |
* @since 0.1
|
283 |
*/
|
284 |
+
function rpwe_excerpt($length)
|
285 |
+
{
|
286 |
|
287 |
+
$excerpt = explode(' ', get_the_excerpt(), $length);
|
288 |
+
if (count($excerpt) >= $length) {
|
289 |
+
array_pop($excerpt);
|
290 |
+
$excerpt = implode(" ", $excerpt) . '…';
|
291 |
} else {
|
292 |
+
$excerpt = implode(" ", $excerpt);
|
293 |
+
}
|
294 |
+
$excerpt = preg_replace('`\[[^\]]*\]`', '', $excerpt);
|
295 |
|
296 |
return $excerpt;
|
297 |
|
298 |
}
|
299 |
+
|
300 |
?>
|
languages/rpwe.mo
CHANGED
Binary file
|
languages/rpwe.po
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Recent Posts Widget Extended 0.6\n"
|
4 |
-
"POT-Creation-Date: 2013-
|
5 |
-
"PO-Revision-Date: 2013-
|
6 |
"Last-Translator: M.Satrya <satrya@tokokoo.com>\n"
|
7 |
"Language-Team: Satrya <satrya@tokokoo.com>\n"
|
8 |
"Language: English\n"
|
@@ -16,64 +16,72 @@ msgstr ""
|
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
"X-Poedit-SearchPath-0: ..\n"
|
18 |
|
19 |
-
#: ../includes/widget-recent-posts-extended.php:
|
20 |
msgid "Advanced recent posts widget."
|
21 |
msgstr ""
|
22 |
|
23 |
-
#: ../includes/widget-recent-posts-extended.php:
|
24 |
msgid "» Recent Posts Widget Extended"
|
25 |
msgstr ""
|
26 |
|
27 |
-
#: ../includes/widget-recent-posts-extended.php:
|
28 |
-
#: ../includes/widget-recent-posts-extended.php:
|
29 |
#, php-format
|
30 |
msgid "Permalink to %s"
|
31 |
msgstr ""
|
32 |
|
33 |
-
#: ../includes/widget-recent-posts-extended.php:
|
34 |
msgid " ago"
|
35 |
msgstr ""
|
36 |
|
37 |
-
#: ../includes/widget-recent-posts-extended.php:
|
38 |
msgid "Title:"
|
39 |
msgstr ""
|
40 |
|
41 |
-
#: ../includes/widget-recent-posts-extended.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
msgid "Limit:"
|
43 |
msgstr ""
|
44 |
|
45 |
-
#: ../includes/widget-recent-posts-extended.php:
|
46 |
-
msgid "Display
|
47 |
msgstr ""
|
48 |
|
49 |
-
#: ../includes/widget-recent-posts-extended.php:
|
50 |
-
msgid "Display
|
51 |
msgstr ""
|
52 |
|
53 |
-
#: ../includes/widget-recent-posts-extended.php:
|
54 |
-
msgid "Excerpt
|
55 |
msgstr ""
|
56 |
|
57 |
-
#: ../includes/widget-recent-posts-extended.php:
|
58 |
-
msgid "Display
|
59 |
msgstr ""
|
60 |
|
61 |
-
#: ../includes/widget-recent-posts-extended.php:
|
62 |
-
msgid "Thumbnail
|
63 |
msgstr ""
|
64 |
|
65 |
-
#: ../includes/widget-recent-posts-extended.php:
|
66 |
-
msgid "Limit to
|
67 |
msgstr ""
|
68 |
|
69 |
-
#: ../includes/widget-recent-posts-extended.php:
|
70 |
msgid "All categories"
|
71 |
msgstr ""
|
72 |
|
73 |
-
#: ../includes/widget-recent-posts-extended.php:
|
74 |
msgid "Choose the Post Type: "
|
75 |
msgstr ""
|
76 |
|
77 |
-
#: ../includes/widget-recent-posts-extended.php:
|
78 |
msgid "Custom CSS:"
|
79 |
msgstr ""
|
1 |
msgid ""
|
2 |
msgstr ""
|
3 |
"Project-Id-Version: Recent Posts Widget Extended 0.6\n"
|
4 |
+
"POT-Creation-Date: 2013-06-15 16:54+0700\n"
|
5 |
+
"PO-Revision-Date: 2013-06-15 16:54+0700\n"
|
6 |
"Last-Translator: M.Satrya <satrya@tokokoo.com>\n"
|
7 |
"Language-Team: Satrya <satrya@tokokoo.com>\n"
|
8 |
"Language: English\n"
|
16 |
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
"X-Poedit-SearchPath-0: ..\n"
|
18 |
|
19 |
+
#: ../includes/widget-recent-posts-extended.php:17
|
20 |
msgid "Advanced recent posts widget."
|
21 |
msgstr ""
|
22 |
|
23 |
+
#: ../includes/widget-recent-posts-extended.php:26
|
24 |
msgid "» Recent Posts Widget Extended"
|
25 |
msgstr ""
|
26 |
|
27 |
+
#: ../includes/widget-recent-posts-extended.php:88
|
28 |
+
#: ../includes/widget-recent-posts-extended.php:100
|
29 |
#, php-format
|
30 |
msgid "Permalink to %s"
|
31 |
msgstr ""
|
32 |
|
33 |
+
#: ../includes/widget-recent-posts-extended.php:104
|
34 |
msgid " ago"
|
35 |
msgstr ""
|
36 |
|
37 |
+
#: ../includes/widget-recent-posts-extended.php:194
|
38 |
msgid "Title:"
|
39 |
msgstr ""
|
40 |
|
41 |
+
#: ../includes/widget-recent-posts-extended.php:198
|
42 |
+
msgid "Widget CSS ID: (no spaces or special characters)"
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: ../includes/widget-recent-posts-extended.php:202
|
46 |
+
msgid "Cache Life: (in seconds. Default is 43200, 1 to disable)"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: ../includes/widget-recent-posts-extended.php:206
|
50 |
msgid "Limit:"
|
51 |
msgstr ""
|
52 |
|
53 |
+
#: ../includes/widget-recent-posts-extended.php:214
|
54 |
+
msgid "Display Date?"
|
55 |
msgstr ""
|
56 |
|
57 |
+
#: ../includes/widget-recent-posts-extended.php:218
|
58 |
+
msgid "Display Excerpt?"
|
59 |
msgstr ""
|
60 |
|
61 |
+
#: ../includes/widget-recent-posts-extended.php:222
|
62 |
+
msgid "Excerpt Length:"
|
63 |
msgstr ""
|
64 |
|
65 |
+
#: ../includes/widget-recent-posts-extended.php:229
|
66 |
+
msgid "Display Thumbnail?"
|
67 |
msgstr ""
|
68 |
|
69 |
+
#: ../includes/widget-recent-posts-extended.php:233
|
70 |
+
msgid "Thumbnail Size (height x width):"
|
71 |
msgstr ""
|
72 |
|
73 |
+
#: ../includes/widget-recent-posts-extended.php:241
|
74 |
+
msgid "Limit to Category: "
|
75 |
msgstr ""
|
76 |
|
77 |
+
#: ../includes/widget-recent-posts-extended.php:242
|
78 |
msgid "All categories"
|
79 |
msgstr ""
|
80 |
|
81 |
+
#: ../includes/widget-recent-posts-extended.php:245
|
82 |
msgid "Choose the Post Type: "
|
83 |
msgstr ""
|
84 |
|
85 |
+
#: ../includes/widget-recent-posts-extended.php:254
|
86 |
msgid "Custom CSS:"
|
87 |
msgstr ""
|
readme.txt
CHANGED
@@ -1,17 +1,17 @@
|
|
1 |
=== Plugin Name ===
|
2 |
-
Contributors: tokokoo, satrya
|
3 |
Tags: recent posts, thumbnails, widget, widgets, sidebar, excerpt, transient api, multiple widgets
|
4 |
Requires at least: 3.3
|
5 |
Tested up to: 3.5
|
6 |
-
Stable tag: 0.7
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
-
Provides
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
-
This plugin will enable a custom,
|
15 |
|
16 |
= Features Include: =
|
17 |
|
@@ -20,9 +20,10 @@ This plugin will enable a custom, fleksible and advanced recent posts widget. Al
|
|
20 |
* Display from all or a specific category.
|
21 |
* Display post date.
|
22 |
* Post type option.
|
23 |
-
* Support
|
24 |
-
* Transients API.
|
25 |
* Multiple widgets.
|
|
|
26 |
|
27 |
= Ugly Image Sizes =
|
28 |
This plugin creates custom image sizes. If you use images that were uploaded to the media library before you installed this plugin, please install [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/) plugin to corrected the sizes.
|
@@ -47,6 +48,13 @@ This plugin creates custom image sizes. If you use images that were uploaded to
|
|
47 |
|
48 |
== Changelog ==
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
= 0.7 =
|
51 |
* Remove `a` tag when no thumbnail
|
52 |
* Add custom css box
|
1 |
=== Plugin Name ===
|
2 |
+
Contributors: tokokoo, satrya, davidkryzaniak
|
3 |
Tags: recent posts, thumbnails, widget, widgets, sidebar, excerpt, transient api, multiple widgets
|
4 |
Requires at least: 3.3
|
5 |
Tested up to: 3.5
|
6 |
+
Stable tag: 0.7.1
|
7 |
License: GPLv2 or later
|
8 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
9 |
|
10 |
+
Provides flexible and advanced recent posts widget. Allows you to display them with thumbnails, post excerpt, specific category and more.
|
11 |
|
12 |
== Description ==
|
13 |
|
14 |
+
This plugin will enable a custom, flexible and advanced recent posts widget. Allows you to display a list of the most recent posts with thumbnail and excerpt, also you can display it from all or a specific category. The recent posts widget extended uses [Transients API](http://codex.wordpress.org/Transients_API) for delivering cached to optimize your site performance when used the widget.
|
15 |
|
16 |
= Features Include: =
|
17 |
|
20 |
* Display from all or a specific category.
|
21 |
* Display post date.
|
22 |
* Post type option.
|
23 |
+
* Support `get_the_image` function.
|
24 |
+
* Transients API with cache life timer.
|
25 |
* Multiple widgets.
|
26 |
+
* Comes pre-styled, but comes proper CSS IDs and Classes to make it match your site.
|
27 |
|
28 |
= Ugly Image Sizes =
|
29 |
This plugin creates custom image sizes. If you use images that were uploaded to the media library before you installed this plugin, please install [Regenerate Thumbnails](http://wordpress.org/extend/plugins/regenerate-thumbnails/) plugin to corrected the sizes.
|
48 |
|
49 |
== Changelog ==
|
50 |
|
51 |
+
= 0.7.1 =
|
52 |
+
PLEASE RE-SAVE THE WIDGET
|
53 |
+
* Added setting for cache life
|
54 |
+
* Added input for CSS class (used for custom styling)
|
55 |
+
* Fix the inline issue on some themes
|
56 |
+
* Update language
|
57 |
+
|
58 |
= 0.7 =
|
59 |
* Remove `a` tag when no thumbnail
|
60 |
* Add custom css box
|
rpwe.css
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
/*
|
2 |
Description: Custom CSS for the Recent Posts Widget Extended.
|
3 |
-
Version: 0.
|
4 |
-
Revision: 0.7
|
5 |
Author: Satrya
|
6 |
License: GPLv2
|
7 |
*/
|
@@ -19,6 +19,7 @@ License: GPLv2
|
|
19 |
}
|
20 |
|
21 |
.rpwe-block a {
|
|
|
22 |
text-decoration: none;
|
23 |
}
|
24 |
|
1 |
/*
|
2 |
Description: Custom CSS for the Recent Posts Widget Extended.
|
3 |
+
Version: 0.2
|
4 |
+
Revision: 0.7.1
|
5 |
Author: Satrya
|
6 |
License: GPLv2
|
7 |
*/
|
19 |
}
|
20 |
|
21 |
.rpwe-block a {
|
22 |
+
display: inline !important;
|
23 |
text-decoration: none;
|
24 |
}
|
25 |
|
rpwe.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Recent Posts Widget Extended
|
4 |
-
Plugin URI: http://wordpress.org/
|
5 |
Description: Enables recent posts widget with advanced settings.
|
6 |
-
Version: 0.7
|
7 |
Author: Satrya
|
8 |
Author URI: http://tokokoo.com
|
9 |
Author Email: satrya@tokokoo.com
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Recent Posts Widget Extended
|
4 |
+
Plugin URI: http://wordpress.org/plugins/recent-posts-widget-extended/
|
5 |
Description: Enables recent posts widget with advanced settings.
|
6 |
+
Version: 0.7.1
|
7 |
Author: Satrya
|
8 |
Author URI: http://tokokoo.com
|
9 |
Author Email: satrya@tokokoo.com
|