Version Description
- Initial release
Download this release
Release Info
Developer | satrya |
Plugin | Recent Posts Widget Extended |
Version | 0.1 |
Comparing to | |
See all releases |
Version 0.1
- includes/widget-recent-posts-extended.php +237 -0
- languages/rpwe.mo +0 -0
- languages/rpwe.po +61 -0
- readme.txt +42 -0
- rpwe.css +51 -0
- rpwe.php +93 -0
- screenshot-1.png +0 -0
includes/widget-recent-posts-extended.php
ADDED
@@ -0,0 +1,237 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
// Exit if accessed directly
|
4 |
+
if ( !defined('ABSPATH') ) exit;
|
5 |
+
|
6 |
+
class rpwe_widget extends WP_Widget {
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Widget setup
|
10 |
+
*/
|
11 |
+
function rpwe_widget() {
|
12 |
+
|
13 |
+
$widget_ops = array(
|
14 |
+
'classname' => 'rpwe_widget',
|
15 |
+
'description' => __( 'Advanced recent posts widget.', 'rpwe' )
|
16 |
+
);
|
17 |
+
|
18 |
+
$control_ops = array(
|
19 |
+
'width' => 300,
|
20 |
+
'height' => 350,
|
21 |
+
'id_base' => 'rpwe_widget'
|
22 |
+
);
|
23 |
+
|
24 |
+
$this->WP_Widget( 'rpwe_widget', __( '» Recent Posts Widget Extended', 'rpwe' ), $widget_ops, $control_ops );
|
25 |
+
|
26 |
+
}
|
27 |
+
|
28 |
+
/**
|
29 |
+
* Display widget
|
30 |
+
*/
|
31 |
+
function widget( $args, $instance ) {
|
32 |
+
extract( $args, EXTR_SKIP );
|
33 |
+
|
34 |
+
$title = apply_filters( 'widget_title', $instance['title'] );
|
35 |
+
$limit = $instance['limit'];
|
36 |
+
$excerpt = $instance['excerpt'];
|
37 |
+
$length = (int)( $instance['length'] );
|
38 |
+
$thumb = $instance['thumb'];
|
39 |
+
$thumb_height = (int)( $instance['thumb_height'] );
|
40 |
+
$thumb_width = (int)( $instance['thumb_width'] );
|
41 |
+
$cat = $instance['cat'];
|
42 |
+
$post_type = $instance['post_type'];
|
43 |
+
|
44 |
+
echo $before_widget;
|
45 |
+
|
46 |
+
if (!empty( $title ))
|
47 |
+
echo $before_title . $title . $after_title;
|
48 |
+
|
49 |
+
global $post;
|
50 |
+
|
51 |
+
if ( false === ( $rpwewidget = get_transient( 'rpwewidget_' . $widget_id ) ) ) {
|
52 |
+
|
53 |
+
$args = array(
|
54 |
+
'numberposts' => $limit,
|
55 |
+
'offset'=> 0,
|
56 |
+
'cat' => $cat,
|
57 |
+
'post_type' => $post_type
|
58 |
+
);
|
59 |
+
|
60 |
+
$rpwewidget = get_posts( $args );
|
61 |
+
|
62 |
+
set_transient( 'rpwewidget_' . $widget_id, $rpwewidget, 60*60*12 );
|
63 |
+
|
64 |
+
} ?>
|
65 |
+
|
66 |
+
<div class="rpwe-block">
|
67 |
+
|
68 |
+
<ul>
|
69 |
+
|
70 |
+
<?php foreach( $rpwewidget as $post ) : setup_postdata( $post ); ?>
|
71 |
+
|
72 |
+
<li class="rpwe-clearfix">
|
73 |
+
|
74 |
+
<a href="<?php esc_url( the_permalink() ); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'rpwe' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark">
|
75 |
+
<?php if( has_post_thumbnail() && $thumb == true ) the_post_thumbnail( array( $thumb_height, $thumb_width ), array( 'class' => 'rpwe-alignleft', 'alt' => get_the_title(), 'title' => get_the_title() ) ); ?>
|
76 |
+
<h3 class="rpwe-title"><?php esc_attr( the_title() ); ?></h3>
|
77 |
+
</a>
|
78 |
+
|
79 |
+
<?php if( $excerpt == true ) { ?>
|
80 |
+
<div class="rpwe-summary"><?php echo rpwe_excerpt( $length ); ?></div>
|
81 |
+
<?php } ?>
|
82 |
+
|
83 |
+
</li>
|
84 |
+
|
85 |
+
<?php endforeach; ?>
|
86 |
+
|
87 |
+
</ul>
|
88 |
+
|
89 |
+
</div><!-- .rpwe-block -->
|
90 |
+
|
91 |
+
<?php
|
92 |
+
|
93 |
+
echo $after_widget;
|
94 |
+
|
95 |
+
}
|
96 |
+
|
97 |
+
/**
|
98 |
+
* Update widget
|
99 |
+
*/
|
100 |
+
function update( $new_instance, $old_instance ) {
|
101 |
+
|
102 |
+
$instance = $old_instance;
|
103 |
+
$instance['title'] = esc_attr( $new_instance['title'] );
|
104 |
+
$instance['limit'] = $new_instance['limit'];
|
105 |
+
$instance['excerpt'] = $new_instance['excerpt'];
|
106 |
+
$instance['length'] = (int)( $new_instance['length'] );
|
107 |
+
$instance['thumb'] = $new_instance['thumb'];
|
108 |
+
$instance['thumb_height'] = (int)( $new_instance['thumb_height'] );
|
109 |
+
$instance['thumb_width'] = (int)( $new_instance['thumb_width'] );
|
110 |
+
$instance['cat'] = $new_instance['cat'];
|
111 |
+
$instance['post_type'] = $new_instance['post_type'];
|
112 |
+
|
113 |
+
delete_transient( 'rpwewidget_' . $this->id );
|
114 |
+
|
115 |
+
return $instance;
|
116 |
+
|
117 |
+
}
|
118 |
+
|
119 |
+
/**
|
120 |
+
* Widget setting
|
121 |
+
*/
|
122 |
+
function form( $instance ) {
|
123 |
+
|
124 |
+
/* Set up some default widget settings. */
|
125 |
+
$defaults = array(
|
126 |
+
'title' => '',
|
127 |
+
'limit' => 5,
|
128 |
+
'excerpt' => '',
|
129 |
+
'length' => 20,
|
130 |
+
'thumb' => true,
|
131 |
+
'thumb_height' => 45,
|
132 |
+
'thumb_width' => 45,
|
133 |
+
'cat' => '',
|
134 |
+
'post_type' => ''
|
135 |
+
);
|
136 |
+
|
137 |
+
$instance = wp_parse_args( (array) $instance, $defaults );
|
138 |
+
$title = esc_attr( $instance['title'] );
|
139 |
+
$limit = $instance['limit'];
|
140 |
+
$excerpt = $instance['excerpt'];
|
141 |
+
$length = (int)($instance['length']);
|
142 |
+
$thumb = $instance['thumb'];
|
143 |
+
$thumb_height = (int)( $instance['thumb_height'] );
|
144 |
+
$thumb_width = (int)( $instance['thumb_width'] );
|
145 |
+
$cat = $instance['cat'];
|
146 |
+
$post_type = $instance['post_type'];
|
147 |
+
|
148 |
+
?>
|
149 |
+
|
150 |
+
<p>
|
151 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php _e( 'Title:', 'rpwe' ); ?></label>
|
152 |
+
<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; ?>" />
|
153 |
+
</p>
|
154 |
+
<p>
|
155 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'limit' ) ); ?>"><?php _e( 'Limit:', 'rpwe' ); ?></label>
|
156 |
+
<select class="widefat" name="<?php echo $this->get_field_name( 'limit' ); ?>" id="<?php echo $this->get_field_id( 'limit' ); ?>">
|
157 |
+
<?php for ( $i=1; $i<=20; $i++ ) { ?>
|
158 |
+
<option <?php selected( $limit, $i ) ?> value="<?php echo $i; ?>"><?php echo $i; ?></option>
|
159 |
+
<?php } ?>
|
160 |
+
</select>
|
161 |
+
</p>
|
162 |
+
<p>
|
163 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'excerpt' ) ); ?>"><?php _e( 'Display excerpt?', 'rpwe' ); ?></label>
|
164 |
+
<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 ); ?> />
|
165 |
+
</p>
|
166 |
+
<p>
|
167 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'length' ) ); ?>"><?php _e( 'Excerpt length:', 'rpwe' ); ?></label>
|
168 |
+
<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; ?>" />
|
169 |
+
</p>
|
170 |
+
|
171 |
+
<?php if( current_theme_supports( 'post-thumbnails' ) ) { ?>
|
172 |
+
|
173 |
+
<p>
|
174 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'thumb' ) ); ?>"><?php _e( 'Display thumbnail?', 'rpwe' ); ?></label>
|
175 |
+
<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 ); ?> />
|
176 |
+
</p>
|
177 |
+
<p>
|
178 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'thumb_height' ) ); ?>"><?php _e( 'Thumbnail size (height x width):', 'rpwe' ); ?></label>
|
179 |
+
<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; ?>" />
|
180 |
+
<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; ?>" />
|
181 |
+
</p>
|
182 |
+
|
183 |
+
<?php } ?>
|
184 |
+
|
185 |
+
<p>
|
186 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'cat' ) ); ?>"><?php _e( 'Limit to category: ' , 'rpwe' ); ?></label>
|
187 |
+
<?php wp_dropdown_categories( array( 'name' => $this->get_field_name( 'cat' ), 'show_option_all' => __( 'All categories' , 'rpwe' ), 'hide_empty' => 1, 'hierarchical' => 1, 'selected' => $cat ) ); ?>
|
188 |
+
</p>
|
189 |
+
<p>
|
190 |
+
<label for="<?php echo esc_attr( $this->get_field_id( 'post_type' ) ); ?>"><?php _e( 'Choose the Post Type: ' , 'rpwe' ); ?></label>
|
191 |
+
<?php /* pros Justin Tadlock - http://themehybrid.com/ */ ?>
|
192 |
+
<select class="widefat" id="<?php echo $this->get_field_id( 'post_type' ); ?>" name="<?php echo $this->get_field_name( 'post_type' ); ?>">
|
193 |
+
<?php foreach ( get_post_types( '', 'objects' ) as $post_type ) { ?>
|
194 |
+
<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>
|
195 |
+
<?php } ?>
|
196 |
+
</select>
|
197 |
+
</p>
|
198 |
+
|
199 |
+
<?php
|
200 |
+
}
|
201 |
+
|
202 |
+
}
|
203 |
+
|
204 |
+
/**
|
205 |
+
* Register widget.
|
206 |
+
*
|
207 |
+
* @since 0.1
|
208 |
+
*/
|
209 |
+
add_action( 'widgets_init', 'rpwe_register_widget' );
|
210 |
+
function rpwe_register_widget() {
|
211 |
+
|
212 |
+
register_widget( 'rpwe_widget' );
|
213 |
+
|
214 |
+
}
|
215 |
+
|
216 |
+
/**
|
217 |
+
* Print a custom excerpt.
|
218 |
+
* http://bavotasan.com/2009/limiting-the-number-of-words-in-your-excerpt-or-content-in-wordpress/
|
219 |
+
*
|
220 |
+
* @since 0.1
|
221 |
+
*/
|
222 |
+
function rpwe_excerpt( $length ) {
|
223 |
+
|
224 |
+
$excerpt = explode( ' ', get_the_excerpt(), $length );
|
225 |
+
if ( count( $excerpt )>=$length ) {
|
226 |
+
array_pop( $excerpt );
|
227 |
+
$excerpt = implode( " ", $excerpt ) . '…';
|
228 |
+
} else {
|
229 |
+
$excerpt = implode( " ", $excerpt );
|
230 |
+
}
|
231 |
+
$excerpt = preg_replace( '`\[[^\]]*\]`', '', $excerpt );
|
232 |
+
|
233 |
+
return $excerpt;
|
234 |
+
|
235 |
+
}
|
236 |
+
|
237 |
+
?>
|
languages/rpwe.mo
ADDED
Binary file
|
languages/rpwe.po
ADDED
@@ -0,0 +1,61 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Recent Posts Widget Extended 0.1\n"
|
4 |
+
"POT-Creation-Date: 2012-12-03 11:37+0700\n"
|
5 |
+
"PO-Revision-Date: 2012-12-03 11:39+0700\n"
|
6 |
+
"Last-Translator: M.Satrya <asksatrya@gmail.com>\n"
|
7 |
+
"Language-Team: satrya <asksatrya@gmail.com>\n"
|
8 |
+
"Language: English\n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"X-Generator: Poedit 1.5.4\n"
|
13 |
+
|
14 |
+
#: widget-recent-posts-extended.php:15
|
15 |
+
msgid "Advanced recent posts widget."
|
16 |
+
msgstr ""
|
17 |
+
|
18 |
+
#: widget-recent-posts-extended.php:24
|
19 |
+
msgid "» Recent Posts Widget Extended"
|
20 |
+
msgstr ""
|
21 |
+
|
22 |
+
#: widget-recent-posts-extended.php:74
|
23 |
+
#, php-format
|
24 |
+
msgid "Permalink to %s"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
#: widget-recent-posts-extended.php:153
|
28 |
+
msgid "Title:"
|
29 |
+
msgstr ""
|
30 |
+
|
31 |
+
#: widget-recent-posts-extended.php:157
|
32 |
+
msgid "Limit:"
|
33 |
+
msgstr ""
|
34 |
+
|
35 |
+
#: widget-recent-posts-extended.php:165
|
36 |
+
msgid "Display excerpt?"
|
37 |
+
msgstr ""
|
38 |
+
|
39 |
+
#: widget-recent-posts-extended.php:169
|
40 |
+
msgid "Excerpt length:"
|
41 |
+
msgstr ""
|
42 |
+
|
43 |
+
#: widget-recent-posts-extended.php:176
|
44 |
+
msgid "Display thumbnail?"
|
45 |
+
msgstr ""
|
46 |
+
|
47 |
+
#: widget-recent-posts-extended.php:180
|
48 |
+
msgid "Thumbnail size (height x width):"
|
49 |
+
msgstr ""
|
50 |
+
|
51 |
+
#: widget-recent-posts-extended.php:188
|
52 |
+
msgid "Limit to category: "
|
53 |
+
msgstr ""
|
54 |
+
|
55 |
+
#: widget-recent-posts-extended.php:189
|
56 |
+
msgid "All categories"
|
57 |
+
msgstr ""
|
58 |
+
|
59 |
+
#: widget-recent-posts-extended.php:192
|
60 |
+
msgid "Choose the Post Type: "
|
61 |
+
msgstr ""
|
readme.txt
ADDED
@@ -0,0 +1,42 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== Plugin Name ===
|
2 |
+
Contributors: marga satrya, tokokoo
|
3 |
+
Donate link:
|
4 |
+
Tags: recent posts, thumbnails, widget, widgets, sidebar
|
5 |
+
Requires at least: 3.3
|
6 |
+
Tested up to: 3.4.2
|
7 |
+
Stable tag: 0.1
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
Provides recent posts widget with a more advanced settings.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
This plugin will enable a custom 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.
|
16 |
+
|
17 |
+
= Features Include: =
|
18 |
+
|
19 |
+
* Display thumbnails, with customizable size.
|
20 |
+
* Display excerpt, with customizable length.
|
21 |
+
* Display from all or a specific category.
|
22 |
+
* Post type option.
|
23 |
+
* Transients API
|
24 |
+
|
25 |
+
= To Do: =
|
26 |
+
* Display meta(author, comment, date)
|
27 |
+
|
28 |
+
= Support: =
|
29 |
+
Please open issue on [github issue](https://github.com/tokokoo/recent-posts-widget-extended/issues) for any support question and translation submission.
|
30 |
+
|
31 |
+
== Installation ==
|
32 |
+
|
33 |
+
1. Upload the 'recent-posts-widget-extended' folder to the `/wp-content/plugins/` directory
|
34 |
+
2. Activate the plugin through the 'Plugins' menu in WordPress
|
35 |
+
|
36 |
+
== Screenshots ==
|
37 |
+
1. The widget settings
|
38 |
+
|
39 |
+
== Changelog ==
|
40 |
+
|
41 |
+
= 0.1 =
|
42 |
+
* Initial release
|
rpwe.css
ADDED
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*
|
2 |
+
Description: Custom CSS for the Recent Posts Widget Extended.
|
3 |
+
Version: 0.1
|
4 |
+
Author: Marga Satrya
|
5 |
+
License: GPLv2
|
6 |
+
*/
|
7 |
+
|
8 |
+
.rpwe-block ul {
|
9 |
+
list-style: none !important;
|
10 |
+
margin-left: 0 !important;
|
11 |
+
padding-left: 0 !important;
|
12 |
+
}
|
13 |
+
|
14 |
+
.rpwe-block li {
|
15 |
+
border-bottom: 1px solid #eee;
|
16 |
+
margin-bottom: 10px;
|
17 |
+
padding-bottom: 10px;
|
18 |
+
}
|
19 |
+
|
20 |
+
.rpwe-block h3 {
|
21 |
+
clear: none;
|
22 |
+
margin-bottom: 0 !important;
|
23 |
+
font-weight: normal;
|
24 |
+
line-height: 1.5em;
|
25 |
+
}
|
26 |
+
|
27 |
+
.rpwe-alignleft {
|
28 |
+
border: none !important;
|
29 |
+
display: inline;
|
30 |
+
float: left;
|
31 |
+
margin: 5px 10px 0 0;
|
32 |
+
padding: 0 !important;
|
33 |
+
}
|
34 |
+
|
35 |
+
.rpwe-summary {
|
36 |
+
font-size: 12px;
|
37 |
+
}
|
38 |
+
|
39 |
+
.rpwe-clearfix:before,
|
40 |
+
.rpwe-clearfix:after {
|
41 |
+
content: "";
|
42 |
+
display: table;
|
43 |
+
}
|
44 |
+
|
45 |
+
.rpwe-clearfix:after {
|
46 |
+
clear: both;
|
47 |
+
}
|
48 |
+
|
49 |
+
.rpwe-clearfix {
|
50 |
+
*zoom: 1;
|
51 |
+
}
|
rpwe.php
ADDED
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: Recent Posts Widget Extended
|
4 |
+
Plugin URI: http://tokokoo.com
|
5 |
+
Description: Enables recent posts widget with advanced settings.
|
6 |
+
Version: 0.1
|
7 |
+
Author: Marga Satrya
|
8 |
+
Author URI: http://tokokoo.com
|
9 |
+
Author Email: satrya@tokokoo.com
|
10 |
+
License: GPLv2
|
11 |
+
*/
|
12 |
+
|
13 |
+
// Exit if accessed directly
|
14 |
+
if ( ! defined( 'ABSPATH' ) ) exit;
|
15 |
+
|
16 |
+
if ( ! class_exists( 'RPW_Extended' ) ) :
|
17 |
+
|
18 |
+
class RPW_Extended {
|
19 |
+
|
20 |
+
/**
|
21 |
+
* PHP5 constructor method.
|
22 |
+
*
|
23 |
+
* @since 0.1
|
24 |
+
*/
|
25 |
+
public function __construct() {
|
26 |
+
|
27 |
+
add_action( 'plugins_loaded', array( &$this, 'constants' ), 1 );
|
28 |
+
|
29 |
+
add_action( 'plugins_loaded', array( &$this, 'i18n' ), 2 );
|
30 |
+
|
31 |
+
add_action( 'plugins_loaded', array( &$this, 'includes' ), 3 );
|
32 |
+
|
33 |
+
add_action( 'init', array( &$this, 'init' ) );
|
34 |
+
|
35 |
+
}
|
36 |
+
|
37 |
+
/**
|
38 |
+
* Defines constants used by the plugin.
|
39 |
+
*
|
40 |
+
* @since 0.1
|
41 |
+
*/
|
42 |
+
public function constants() {
|
43 |
+
|
44 |
+
define( 'RPWE_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
|
45 |
+
|
46 |
+
define( 'RPWE_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
|
47 |
+
|
48 |
+
define( 'RPWE_INCLUDES', RPWE_DIR . trailingslashit( 'includes' ) );
|
49 |
+
|
50 |
+
}
|
51 |
+
|
52 |
+
/**
|
53 |
+
* Loads the translation files.
|
54 |
+
*
|
55 |
+
* @since 0.1
|
56 |
+
*/
|
57 |
+
public function i18n() {
|
58 |
+
|
59 |
+
/* Load the translation of the plugin. */
|
60 |
+
load_plugin_textdomain( 'rpwe', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
|
61 |
+
|
62 |
+
}
|
63 |
+
|
64 |
+
/**
|
65 |
+
* Loads the initial files needed by the plugin.
|
66 |
+
*
|
67 |
+
* @since 0.1
|
68 |
+
*/
|
69 |
+
public function includes() {
|
70 |
+
|
71 |
+
require_once( RPWE_INCLUDES . 'widget-recent-posts-extended.php' );
|
72 |
+
}
|
73 |
+
|
74 |
+
/**
|
75 |
+
* Register custom style for the widget.
|
76 |
+
*
|
77 |
+
* @since 0.1
|
78 |
+
*/
|
79 |
+
function init() {
|
80 |
+
|
81 |
+
if( ! is_admin() ) {
|
82 |
+
|
83 |
+
wp_enqueue_style( 'rpwe-style', RPWE_URI . 'rpwe.css' );
|
84 |
+
|
85 |
+
}
|
86 |
+
|
87 |
+
}
|
88 |
+
|
89 |
+
}
|
90 |
+
|
91 |
+
new RPW_Extended;
|
92 |
+
|
93 |
+
endif;
|
screenshot-1.png
ADDED
Binary file
|