Version Description
- 9/09/2014 =
- Add: Now, you can display posts from multiple post types.
- Fix: Limit to Category and Limit to Tag not working issue.
- Improve: Change multi select with checkbox for Limit to Category and Limit to Tag option for better user experience.
- Experiment: Better image cropping using Aqua Resizer. It should fixed thumbnail not cropping correctly issue.
- Update: Language
Download this release
Release Info
Developer | satrya |
Plugin | Recent Posts Widget Extended |
Version | 0.9.6 |
Comparing to | |
See all releases |
Code changes from version 0.9.5 to 0.9.6
- assets/css/rpwe-admin.css +14 -3
- classes/widget.php +14 -2
- includes/aq_resizer.php +207 -0
- includes/form.php +43 -37
- includes/functions.php +53 -50
- languages/rpwe.mo +0 -0
- languages/rpwe.po +210 -177
- readme.txt +11 -36
- rpwe.php +2 -8
assets/css/rpwe-admin.css
CHANGED
@@ -31,7 +31,18 @@
|
|
31 |
display: block;
|
32 |
}
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
}
|
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 |
}
|
classes/widget.php
CHANGED
@@ -73,6 +73,18 @@ class Recent_Posts_Widget_Extended extends WP_Widget {
|
|
73 |
* @since 0.1
|
74 |
*/
|
75 |
function update( $new_instance, $old_instance ) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
|
77 |
$instance = $old_instance;
|
78 |
$instance['title'] = strip_tags( $new_instance['title'] );
|
@@ -83,10 +95,10 @@ class Recent_Posts_Widget_Extended extends WP_Widget {
|
|
83 |
$instance['offset'] = (int)( $new_instance['offset'] );
|
84 |
$instance['order'] = $new_instance['order'];
|
85 |
$instance['orderby'] = $new_instance['orderby'];
|
|
|
|
|
86 |
$instance['cat'] = $new_instance['cat'];
|
87 |
$instance['tag'] = $new_instance['tag'];
|
88 |
-
$instance['post_type'] = esc_attr( $new_instance['post_type'] );
|
89 |
-
$instance['post_status'] = esc_attr( $new_instance['post_status'] );
|
90 |
$instance['taxonomy'] = esc_attr( $new_instance['taxonomy'] );
|
91 |
|
92 |
$instance['excerpt'] = isset( $new_instance['excerpt'] ) ? (bool) $new_instance['excerpt'] : false;
|
73 |
* @since 0.1
|
74 |
*/
|
75 |
function update( $new_instance, $old_instance ) {
|
76 |
+
|
77 |
+
// Validate post_type submissions
|
78 |
+
$name = get_post_types( array( 'public' => true ), 'names' );
|
79 |
+
$types = array();
|
80 |
+
foreach( $new_instance['post_type'] as $type ) {
|
81 |
+
if ( in_array( $type, $name ) ) {
|
82 |
+
$types[] = $type;
|
83 |
+
}
|
84 |
+
}
|
85 |
+
if ( empty( $types ) ) {
|
86 |
+
$types[] = 'post';
|
87 |
+
}
|
88 |
|
89 |
$instance = $old_instance;
|
90 |
$instance['title'] = strip_tags( $new_instance['title'] );
|
95 |
$instance['offset'] = (int)( $new_instance['offset'] );
|
96 |
$instance['order'] = $new_instance['order'];
|
97 |
$instance['orderby'] = $new_instance['orderby'];
|
98 |
+
$instance['post_type'] = $types;
|
99 |
+
$instance['post_status'] = esc_attr( $new_instance['post_status'] );
|
100 |
$instance['cat'] = $new_instance['cat'];
|
101 |
$instance['tag'] = $new_instance['tag'];
|
|
|
|
|
102 |
$instance['taxonomy'] = esc_attr( $new_instance['taxonomy'] );
|
103 |
|
104 |
$instance['excerpt'] = isset( $new_instance['excerpt'] ) ? (bool) $new_instance['excerpt'] : false;
|
includes/aq_resizer.php
ADDED
@@ -0,0 +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 |
+
* @param string $url - (required) must be uploaded using wp media uploader
|
13 |
+
* @param int $width - (required)
|
14 |
+
* @param int $height - (optional)
|
15 |
+
* @param bool $crop - (optional) default to soft crop
|
16 |
+
* @param bool $single - (optional) returns an array if false
|
17 |
+
* @param bool $upscale - (optional) resizes smaller images
|
18 |
+
* @uses wp_upload_dir()
|
19 |
+
* @uses image_resize_dimensions()
|
20 |
+
* @uses wp_get_image_editor()
|
21 |
+
*
|
22 |
+
* @return str|array
|
23 |
+
*/
|
24 |
+
|
25 |
+
if(!class_exists('Aq_Resize')) {
|
26 |
+
class Aq_Resize
|
27 |
+
{
|
28 |
+
/**
|
29 |
+
* The singleton instance
|
30 |
+
*/
|
31 |
+
static private $instance = null;
|
32 |
+
|
33 |
+
/**
|
34 |
+
* No initialization allowed
|
35 |
+
*/
|
36 |
+
private function __construct() {}
|
37 |
+
|
38 |
+
/**
|
39 |
+
* No cloning allowed
|
40 |
+
*/
|
41 |
+
private function __clone() {}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* For your custom default usage you may want to initialize an Aq_Resize object by yourself and then have own defaults
|
45 |
+
*/
|
46 |
+
static public function getInstance() {
|
47 |
+
if(self::$instance == null) {
|
48 |
+
self::$instance = new self;
|
49 |
+
}
|
50 |
+
|
51 |
+
return self::$instance;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Run, forest.
|
56 |
+
*/
|
57 |
+
public function process( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) {
|
58 |
+
// Validate inputs.
|
59 |
+
if ( ! $url || ( ! $width && ! $height ) ) return false;
|
60 |
+
|
61 |
+
// Caipt'n, ready to hook.
|
62 |
+
if ( true === $upscale ) add_filter( 'image_resize_dimensions', array($this, 'aq_upscale'), 10, 6 );
|
63 |
+
|
64 |
+
// Define upload path & dir.
|
65 |
+
$upload_info = wp_upload_dir();
|
66 |
+
$upload_dir = $upload_info['basedir'];
|
67 |
+
$upload_url = $upload_info['baseurl'];
|
68 |
+
|
69 |
+
$http_prefix = "http://";
|
70 |
+
$https_prefix = "https://";
|
71 |
+
|
72 |
+
/* if the $url scheme differs from $upload_url scheme, make them match
|
73 |
+
if the schemes differe, images don't show up. */
|
74 |
+
if(!strncmp($url,$https_prefix,strlen($https_prefix))){ //if url begins with https:// make $upload_url begin with https:// as well
|
75 |
+
$upload_url = str_replace($http_prefix,$https_prefix,$upload_url);
|
76 |
+
}
|
77 |
+
elseif(!strncmp($url,$http_prefix,strlen($http_prefix))){ //if url begins with http:// make $upload_url begin with http:// as well
|
78 |
+
$upload_url = str_replace($https_prefix,$http_prefix,$upload_url);
|
79 |
+
}
|
80 |
+
|
81 |
+
|
82 |
+
// Check if $img_url is local.
|
83 |
+
if ( false === strpos( $url, $upload_url ) ) return false;
|
84 |
+
|
85 |
+
// Define path of image.
|
86 |
+
$rel_path = str_replace( $upload_url, '', $url );
|
87 |
+
$img_path = $upload_dir . $rel_path;
|
88 |
+
|
89 |
+
// Check if img path exists, and is an image indeed.
|
90 |
+
if ( ! file_exists( $img_path ) or ! getimagesize( $img_path ) ) return false;
|
91 |
+
|
92 |
+
// Get image info.
|
93 |
+
$info = pathinfo( $img_path );
|
94 |
+
$ext = $info['extension'];
|
95 |
+
list( $orig_w, $orig_h ) = getimagesize( $img_path );
|
96 |
+
|
97 |
+
// Get image size after cropping.
|
98 |
+
$dims = image_resize_dimensions( $orig_w, $orig_h, $width, $height, $crop );
|
99 |
+
$dst_w = $dims[4];
|
100 |
+
$dst_h = $dims[5];
|
101 |
+
|
102 |
+
// Return the original image only if it exactly fits the needed measures.
|
103 |
+
if ( ! $dims && ( ( ( null === $height && $orig_w == $width ) xor ( null === $width && $orig_h == $height ) ) xor ( $height == $orig_h && $width == $orig_w ) ) ) {
|
104 |
+
$img_url = $url;
|
105 |
+
$dst_w = $orig_w;
|
106 |
+
$dst_h = $orig_h;
|
107 |
+
} else {
|
108 |
+
// Use this to check if cropped image already exists, so we can return that instead.
|
109 |
+
$suffix = "{$dst_w}x{$dst_h}";
|
110 |
+
$dst_rel_path = str_replace( '.' . $ext, '', $rel_path );
|
111 |
+
$destfilename = "{$upload_dir}{$dst_rel_path}-{$suffix}.{$ext}";
|
112 |
+
|
113 |
+
if ( ! $dims || ( true == $crop && false == $upscale && ( $dst_w < $width || $dst_h < $height ) ) ) {
|
114 |
+
// Can't resize, so return false saying that the action to do could not be processed as planned.
|
115 |
+
return false;
|
116 |
+
}
|
117 |
+
// Else check if cache exists.
|
118 |
+
elseif ( file_exists( $destfilename ) && getimagesize( $destfilename ) ) {
|
119 |
+
$img_url = "{$upload_url}{$dst_rel_path}-{$suffix}.{$ext}";
|
120 |
+
}
|
121 |
+
// Else, we resize the image and return the new resized image url.
|
122 |
+
else {
|
123 |
+
|
124 |
+
$editor = wp_get_image_editor( $img_path );
|
125 |
+
|
126 |
+
if ( is_wp_error( $editor ) || is_wp_error( $editor->resize( $width, $height, $crop ) ) )
|
127 |
+
return false;
|
128 |
+
|
129 |
+
$resized_file = $editor->save();
|
130 |
+
|
131 |
+
if ( ! is_wp_error( $resized_file ) ) {
|
132 |
+
$resized_rel_path = str_replace( $upload_dir, '', $resized_file['path'] );
|
133 |
+
$img_url = $upload_url . $resized_rel_path;
|
134 |
+
} else {
|
135 |
+
return false;
|
136 |
+
}
|
137 |
+
|
138 |
+
}
|
139 |
+
}
|
140 |
+
|
141 |
+
// Okay, leave the ship.
|
142 |
+
if ( true === $upscale ) remove_filter( 'image_resize_dimensions', array( $this, 'aq_upscale' ) );
|
143 |
+
|
144 |
+
// Return the output.
|
145 |
+
if ( $single ) {
|
146 |
+
// str return.
|
147 |
+
$image = $img_url;
|
148 |
+
} else {
|
149 |
+
// array return.
|
150 |
+
$image = array (
|
151 |
+
0 => $img_url,
|
152 |
+
1 => $dst_w,
|
153 |
+
2 => $dst_h
|
154 |
+
);
|
155 |
+
}
|
156 |
+
|
157 |
+
return $image;
|
158 |
+
}
|
159 |
+
|
160 |
+
/**
|
161 |
+
* Callback to overwrite WP computing of thumbnail measures
|
162 |
+
*/
|
163 |
+
function aq_upscale( $default, $orig_w, $orig_h, $dest_w, $dest_h, $crop ) {
|
164 |
+
if ( ! $crop ) return null; // Let the wordpress default function handle this.
|
165 |
+
|
166 |
+
// Here is the point we allow to use larger image size than the original one.
|
167 |
+
$aspect_ratio = $orig_w / $orig_h;
|
168 |
+
$new_w = $dest_w;
|
169 |
+
$new_h = $dest_h;
|
170 |
+
|
171 |
+
if ( ! $new_w ) {
|
172 |
+
$new_w = intval( $new_h * $aspect_ratio );
|
173 |
+
}
|
174 |
+
|
175 |
+
if ( ! $new_h ) {
|
176 |
+
$new_h = intval( $new_w / $aspect_ratio );
|
177 |
+
}
|
178 |
+
|
179 |
+
$size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );
|
180 |
+
|
181 |
+
$crop_w = round( $new_w / $size_ratio );
|
182 |
+
$crop_h = round( $new_h / $size_ratio );
|
183 |
+
|
184 |
+
$s_x = floor( ( $orig_w - $crop_w ) / 2 );
|
185 |
+
$s_y = floor( ( $orig_h - $crop_h ) / 2 );
|
186 |
+
|
187 |
+
return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
|
193 |
+
|
194 |
+
|
195 |
+
|
196 |
+
if(!function_exists('aq_resize')) {
|
197 |
+
|
198 |
+
/**
|
199 |
+
* This is just a tiny wrapper function for the class above so that there is no
|
200 |
+
* need to change any code in your own WP themes. Usage is still the same :)
|
201 |
+
*/
|
202 |
+
function aq_resize( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) {
|
203 |
+
$aq_resize = Aq_Resize::getInstance();
|
204 |
+
return $aq_resize->process( $url, $width, $height, $crop, $single, $upscale );
|
205 |
+
}
|
206 |
+
}
|
207 |
+
|
includes/form.php
CHANGED
@@ -65,18 +65,21 @@
|
|
65 |
</label>
|
66 |
</p>
|
67 |
|
68 |
-
<
|
69 |
-
<label
|
70 |
-
<?php _e( 'Post
|
71 |
</label>
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
80 |
|
81 |
<p>
|
82 |
<label for="<?php echo $this->get_field_id( 'post_status' ); ?>">
|
@@ -115,35 +118,37 @@
|
|
115 |
</select>
|
116 |
</p>
|
117 |
|
118 |
-
<
|
119 |
-
<label
|
120 |
<?php _e( 'Limit to Category', 'rpwe' ); ?>
|
121 |
</label>
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
<
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
|
|
135 |
<?php _e( 'Limit to Tag', 'rpwe' ); ?>
|
136 |
</label>
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
<
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
|
|
147 |
|
148 |
<p>
|
149 |
<label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>">
|
@@ -167,9 +172,10 @@
|
|
167 |
|
168 |
<p>
|
169 |
<label for="<?php echo $this->get_field_id( 'offset' ); ?>">
|
170 |
-
<?php _e( 'Offset
|
171 |
</label>
|
172 |
<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'] ); ?>" />
|
|
|
173 |
</p>
|
174 |
|
175 |
<?php if ( current_theme_supports( 'post-thumbnails' ) ) { ?>
|
65 |
</label>
|
66 |
</p>
|
67 |
|
68 |
+
<div class="rpwe-multiple-check-form">
|
69 |
+
<label>
|
70 |
+
<?php _e( 'Post Types', 'rpwe' ); ?>
|
71 |
</label>
|
72 |
+
<ul>
|
73 |
+
<?php foreach ( get_post_types( array( 'public' => true ), 'objects' ) as $type ) : ?>
|
74 |
+
<li>
|
75 |
+
<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'] ) ); ?> />
|
76 |
+
<label for="<?php echo $this->get_field_id( 'post_type' ) . '-' . $type->name; ?>">
|
77 |
+
<?php echo esc_html( $type->labels->name ); ?>
|
78 |
+
</label>
|
79 |
+
</li>
|
80 |
+
<?php endforeach; ?>
|
81 |
+
</ul>
|
82 |
+
</div>
|
83 |
|
84 |
<p>
|
85 |
<label for="<?php echo $this->get_field_id( 'post_status' ); ?>">
|
118 |
</select>
|
119 |
</p>
|
120 |
|
121 |
+
<div class="rpwe-multiple-check-form">
|
122 |
+
<label>
|
123 |
<?php _e( 'Limit to Category', 'rpwe' ); ?>
|
124 |
</label>
|
125 |
+
<ul>
|
126 |
+
<?php foreach ( get_terms( 'category' ) as $category ) : ?>
|
127 |
+
<li>
|
128 |
+
<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'] ) ); ?> />
|
129 |
+
<label for="<?php echo $this->get_field_id( 'cat' ) . '-' . (int) $category->term_id; ?>">
|
130 |
+
<?php echo esc_html( $category->name ); ?>
|
131 |
+
</label>
|
132 |
+
</li>
|
133 |
+
<?php endforeach; ?>
|
134 |
+
</ul>
|
135 |
+
</div>
|
136 |
+
|
137 |
+
<div class="rpwe-multiple-check-form">
|
138 |
+
<label>
|
139 |
<?php _e( 'Limit to Tag', 'rpwe' ); ?>
|
140 |
</label>
|
141 |
+
<ul>
|
142 |
+
<?php foreach ( get_terms( 'post_tag' ) as $post_tag ) : ?>
|
143 |
+
<li>
|
144 |
+
<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'] ) ); ?> />
|
145 |
+
<label for="<?php echo $this->get_field_id( 'tag' ) . '-' . (int) $post_tag->term_id; ?>">
|
146 |
+
<?php echo esc_html( $post_tag->name ); ?>
|
147 |
+
</label>
|
148 |
+
</li>
|
149 |
+
<?php endforeach; ?>
|
150 |
+
</ul>
|
151 |
+
</div>
|
152 |
|
153 |
<p>
|
154 |
<label for="<?php echo $this->get_field_id( 'taxonomy' ); ?>">
|
172 |
|
173 |
<p>
|
174 |
<label for="<?php echo $this->get_field_id( 'offset' ); ?>">
|
175 |
+
<?php _e( 'Offset', 'rpwe' ); ?>
|
176 |
</label>
|
177 |
<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'] ); ?>" />
|
178 |
+
<small><?php _e( 'The number of posts to skip', 'rpwe' ); ?></small>
|
179 |
</p>
|
180 |
|
181 |
<?php if ( current_theme_supports( 'post-thumbnails' ) ) { ?>
|
includes/functions.php
CHANGED
@@ -26,10 +26,10 @@ function rpwe_get_default_args() {
|
|
26 |
'offset' => 0,
|
27 |
'order' => 'DESC',
|
28 |
'orderby' => 'date',
|
29 |
-
'cat' =>
|
30 |
-
'tag' =>
|
31 |
'taxonomy' => '',
|
32 |
-
'post_type' => 'post',
|
33 |
'post_status' => 'publish',
|
34 |
'ignore_sticky' => 1,
|
35 |
|
@@ -77,11 +77,8 @@ function rpwe_get_recent_posts( $args = array() ) {
|
|
77 |
// Set up a default, empty variable.
|
78 |
$html = '';
|
79 |
|
80 |
-
// Get the default arguments.
|
81 |
-
$defaults = rpwe_get_default_args();
|
82 |
-
|
83 |
// Merge the input arguments and the defaults.
|
84 |
-
$args = wp_parse_args( $args,
|
85 |
|
86 |
// Extract the array to allow easy use of variables.
|
87 |
extract( $args );
|
@@ -104,26 +101,26 @@ function rpwe_get_recent_posts( $args = array() ) {
|
|
104 |
|
105 |
if ( $posts->have_posts() ) :
|
106 |
|
107 |
-
$html = '<div ' . ( ! empty( $args['cssID'] ) ? 'id="' . sanitize_html_class( $args['cssID'] ) . '"' : '' ) . ' class="rpwe-block
|
108 |
|
109 |
$html .= '<ul class="rpwe-ul">';
|
110 |
|
111 |
while ( $posts->have_posts() ) : $posts->the_post();
|
112 |
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
$html .= '<li class="rpwe-li rpwe-clearfix">';
|
114 |
|
115 |
if ( $args['thumb'] ) :
|
116 |
|
117 |
// Check if post has post thumbnail.
|
118 |
if ( has_post_thumbnail() ) :
|
119 |
-
$html .= '<a href="' . get_permalink() . '" rel="bookmark">';
|
120 |
-
$html .=
|
121 |
-
array( $args['thumb_width'], $args['thumb_height'], true ),
|
122 |
-
array(
|
123 |
-
'class' => $args['thumb_align'] . ' rpwe-thumb the-post-thumbnail',
|
124 |
-
'alt' => esc_attr( get_the_title() )
|
125 |
-
)
|
126 |
-
);
|
127 |
$html .= '</a>';
|
128 |
|
129 |
// If no post thumbnail found, check if Get The Image plugin exist and display the image.
|
@@ -131,7 +128,6 @@ function rpwe_get_recent_posts( $args = array() ) {
|
|
131 |
$html .= get_the_image( array(
|
132 |
'height' => $args['thumb_height'],
|
133 |
'width' => $args['thumb_width'],
|
134 |
-
'size' => 'rpwe-thumbnail',
|
135 |
'image_class' => $args['thumb_align'] . ' rpwe-thumb get-the-image',
|
136 |
'image_scan' => true,
|
137 |
'default_image' => $args['thumb_default']
|
@@ -197,36 +193,6 @@ function rpwe_get_recent_posts( $args = array() ) {
|
|
197 |
*/
|
198 |
function rpwe_get_posts( $args = array() ) {
|
199 |
|
200 |
-
/**
|
201 |
-
* Taxonomy query.
|
202 |
-
* Prop Miniloop plugin by Kailey Lampert.
|
203 |
-
*/
|
204 |
-
parse_str( $args['taxonomy'], $taxes );
|
205 |
-
$tax_query = array();
|
206 |
-
foreach( array_keys( $taxes ) as $k => $slug ) {
|
207 |
-
$ids = explode( ',', $taxes[$slug] );
|
208 |
-
$tax_query[] = array(
|
209 |
-
'taxonomy' => $slug,
|
210 |
-
'field' => 'id',
|
211 |
-
'terms' => $ids,
|
212 |
-
'operator' => 'IN'
|
213 |
-
);
|
214 |
-
};
|
215 |
-
|
216 |
-
// Array categories
|
217 |
-
if ( $args['cat'] && ! is_array( $args['cat'] ) ) {
|
218 |
-
$args['cat'] = explode( ',', $args['cat'] );
|
219 |
-
} else {
|
220 |
-
$args['cat'] = NULL;
|
221 |
-
}
|
222 |
-
|
223 |
-
// Array tags
|
224 |
-
if ( $args['tag'] && ! is_array( $args['tag'] ) ) {
|
225 |
-
$args['tag'] = explode( ',', $args['tag'] );
|
226 |
-
} else {
|
227 |
-
$args['tag'] = NULL;
|
228 |
-
}
|
229 |
-
|
230 |
// Query arguments.
|
231 |
$query = array(
|
232 |
'offset' => $args['offset'],
|
@@ -236,11 +202,48 @@ function rpwe_get_posts( $args = array() ) {
|
|
236 |
'post_type' => $args['post_type'],
|
237 |
'post_status' => $args['post_status'],
|
238 |
'ignore_sticky_posts' => $args['ignore_sticky'],
|
239 |
-
'category__in' => $args['cat'],
|
240 |
-
'tag__in' => $args['tag'],
|
241 |
-
'tax_query' => $tax_query,
|
242 |
);
|
243 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
244 |
// Allow plugins/themes developer to filter the default query.
|
245 |
$query = apply_filters( 'rpwe_default_query_arguments', $query );
|
246 |
|
26 |
'offset' => 0,
|
27 |
'order' => 'DESC',
|
28 |
'orderby' => 'date',
|
29 |
+
'cat' => array(),
|
30 |
+
'tag' => array(),
|
31 |
'taxonomy' => '',
|
32 |
+
'post_type' => array( 'post' ),
|
33 |
'post_status' => 'publish',
|
34 |
'ignore_sticky' => 1,
|
35 |
|
77 |
// Set up a default, empty variable.
|
78 |
$html = '';
|
79 |
|
|
|
|
|
|
|
80 |
// Merge the input arguments and the defaults.
|
81 |
+
$args = wp_parse_args( $args, rpwe_get_default_args() );
|
82 |
|
83 |
// Extract the array to allow easy use of variables.
|
84 |
extract( $args );
|
101 |
|
102 |
if ( $posts->have_posts() ) :
|
103 |
|
104 |
+
$html = '<div ' . ( ! empty( $args['cssID'] ) ? 'id="' . sanitize_html_class( $args['cssID'] ) . '"' : '' ) . ' class="rpwe-block">';
|
105 |
|
106 |
$html .= '<ul class="rpwe-ul">';
|
107 |
|
108 |
while ( $posts->have_posts() ) : $posts->the_post();
|
109 |
|
110 |
+
// Experiment!
|
111 |
+
// Cropping image using Aqua Resizer
|
112 |
+
$thumb_id = get_post_thumbnail_id();
|
113 |
+
$img_url = wp_get_attachment_url( $thumb_id, 'full' ); // Get img URL.
|
114 |
+
$image = aq_resize( $img_url, $args['thumb_width'], $args['thumb_height'], true ); // Resize & crop img.
|
115 |
+
|
116 |
$html .= '<li class="rpwe-li rpwe-clearfix">';
|
117 |
|
118 |
if ( $args['thumb'] ) :
|
119 |
|
120 |
// Check if post has post thumbnail.
|
121 |
if ( has_post_thumbnail() ) :
|
122 |
+
$html .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
|
123 |
+
$html .= '<img class="' . $args['thumb_align'] . ' rpwe-thumb get-the-image" src="' . esc_url( $image ) . '" alt="' . esc_attr( get_the_title() ) . '">';
|
|
|
|
|
|
|
|
|
|
|
|
|
124 |
$html .= '</a>';
|
125 |
|
126 |
// If no post thumbnail found, check if Get The Image plugin exist and display the image.
|
128 |
$html .= get_the_image( array(
|
129 |
'height' => $args['thumb_height'],
|
130 |
'width' => $args['thumb_width'],
|
|
|
131 |
'image_class' => $args['thumb_align'] . ' rpwe-thumb get-the-image',
|
132 |
'image_scan' => true,
|
133 |
'default_image' => $args['thumb_default']
|
193 |
*/
|
194 |
function rpwe_get_posts( $args = array() ) {
|
195 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
196 |
// Query arguments.
|
197 |
$query = array(
|
198 |
'offset' => $args['offset'],
|
202 |
'post_type' => $args['post_type'],
|
203 |
'post_status' => $args['post_status'],
|
204 |
'ignore_sticky_posts' => $args['ignore_sticky'],
|
|
|
|
|
|
|
205 |
);
|
206 |
|
207 |
+
// Limit posts based on category.
|
208 |
+
if ( ! empty( $args['cat'] ) ) {
|
209 |
+
$query['category__in'] = $args['cat'];
|
210 |
+
}
|
211 |
+
|
212 |
+
// Limit posts based on post tag.
|
213 |
+
if ( ! empty( $args['tag'] ) ) {
|
214 |
+
$query['tag__in'] = $args['tag'];
|
215 |
+
}
|
216 |
+
|
217 |
+
/**
|
218 |
+
* Taxonomy query.
|
219 |
+
* Prop Miniloop plugin by Kailey Lampert.
|
220 |
+
*/
|
221 |
+
if ( ! empty( $args['taxonomy'] ) ) {
|
222 |
+
|
223 |
+
parse_str( $args['taxonomy'], $taxes );
|
224 |
+
|
225 |
+
$operator = 'IN';
|
226 |
+
$tax_query = array();
|
227 |
+
foreach( array_keys( $taxes ) as $k => $slug ) {
|
228 |
+
$ids = explode( ',', $taxes[$slug] );
|
229 |
+
if ( count( $ids ) == 1 && $ids['0'] < 0 ) {
|
230 |
+
// If there is only one id given, and it's negative
|
231 |
+
// Let's treat it as 'posts not in'
|
232 |
+
$ids['0'] = $ids['0'] * -1;
|
233 |
+
$operator = 'NOT IN';
|
234 |
+
}
|
235 |
+
$tax_query[] = array(
|
236 |
+
'taxonomy' => $slug,
|
237 |
+
'field' => 'id',
|
238 |
+
'terms' => $ids,
|
239 |
+
'operator' => $operator
|
240 |
+
);
|
241 |
+
}
|
242 |
+
|
243 |
+
$query['tax_query'] = $tax_query;
|
244 |
+
|
245 |
+
}
|
246 |
+
|
247 |
// Allow plugins/themes developer to filter the default query.
|
248 |
$query = apply_filters( 'rpwe_default_query_arguments', $query );
|
249 |
|
languages/rpwe.mo
CHANGED
Binary file
|
languages/rpwe.po
CHANGED
@@ -1,177 +1,210 @@
|
|
1 |
-
msgid ""
|
2 |
-
msgstr ""
|
3 |
-
"Project-Id-Version: Recent Posts Widget Extended 0.6\n"
|
4 |
-
"POT-Creation-Date: 2014-
|
5 |
-
"PO-Revision-Date: 2014-
|
6 |
-
"Last-Translator: Satrya <satrya@satrya.me>\n"
|
7 |
-
"Language-Team: Satrya <satrya@satrya.me>\n"
|
8 |
-
"Language: en\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.6.
|
13 |
-
"X-Poedit-KeywordsList: __;_e;esc_attr__;esc_html__\n"
|
14 |
-
"X-Poedit-Basepath: .\n"
|
15 |
-
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
16 |
-
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
-
"X-Poedit-SearchPath-0: ..\n"
|
18 |
-
|
19 |
-
#: ../
|
20 |
-
msgid ""
|
21 |
-
"An advanced widget that gives you total control over the output of your "
|
22 |
-
"site’s most recent Posts."
|
23 |
-
msgstr ""
|
24 |
-
|
25 |
-
#: ../
|
26 |
-
msgid "Recent Posts Extended"
|
27 |
-
msgstr ""
|
28 |
-
|
29 |
-
#: ../includes/
|
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 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: Recent Posts Widget Extended 0.6\n"
|
4 |
+
"POT-Creation-Date: 2014-09-09 14:08+0700\n"
|
5 |
+
"PO-Revision-Date: 2014-09-09 14:08+0700\n"
|
6 |
+
"Last-Translator: Satrya <satrya@satrya.me>\n"
|
7 |
+
"Language-Team: Satrya <satrya@satrya.me>\n"
|
8 |
+
"Language: en\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.6.9\n"
|
13 |
+
"X-Poedit-KeywordsList: __;_e;esc_attr__;esc_html__\n"
|
14 |
+
"X-Poedit-Basepath: .\n"
|
15 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
16 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
17 |
+
"X-Poedit-SearchPath-0: ..\n"
|
18 |
+
|
19 |
+
#: ../classes/widget.php:24
|
20 |
+
msgid ""
|
21 |
+
"An advanced widget that gives you total control over the output of your "
|
22 |
+
"site’s most recent Posts."
|
23 |
+
msgstr ""
|
24 |
+
|
25 |
+
#: ../classes/widget.php:35
|
26 |
+
msgid "Recent Posts Extended"
|
27 |
+
msgstr ""
|
28 |
+
|
29 |
+
#: ../includes/form.php:17 ../includes/form.php:112
|
30 |
+
msgid "Title"
|
31 |
+
msgstr ""
|
32 |
+
|
33 |
+
#: ../includes/form.php:24
|
34 |
+
msgid "Title URL"
|
35 |
+
msgstr ""
|
36 |
+
|
37 |
+
#: ../includes/form.php:31
|
38 |
+
msgid "CSS ID"
|
39 |
+
msgstr ""
|
40 |
+
|
41 |
+
#: ../includes/form.php:39
|
42 |
+
msgid "Use Default Styles"
|
43 |
+
msgstr ""
|
44 |
+
|
45 |
+
#: ../includes/form.php:45
|
46 |
+
msgid "HTML or text before the recent posts"
|
47 |
+
msgstr ""
|
48 |
+
|
49 |
+
#: ../includes/form.php:52
|
50 |
+
msgid "HTML or text after the recent posts"
|
51 |
+
msgstr ""
|
52 |
+
|
53 |
+
#: ../includes/form.php:64
|
54 |
+
msgid "Ignore sticky posts"
|
55 |
+
msgstr ""
|
56 |
+
|
57 |
+
#: ../includes/form.php:70
|
58 |
+
msgid "Post Types"
|
59 |
+
msgstr ""
|
60 |
+
|
61 |
+
#: ../includes/form.php:86
|
62 |
+
msgid "Post Status"
|
63 |
+
msgstr ""
|
64 |
+
|
65 |
+
#: ../includes/form.php:97
|
66 |
+
msgid "Order"
|
67 |
+
msgstr ""
|
68 |
+
|
69 |
+
#: ../includes/form.php:100
|
70 |
+
msgid "Descending"
|
71 |
+
msgstr ""
|
72 |
+
|
73 |
+
#: ../includes/form.php:101
|
74 |
+
msgid "Ascending"
|
75 |
+
msgstr ""
|
76 |
+
|
77 |
+
#: ../includes/form.php:107
|
78 |
+
msgid "Orderby"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: ../includes/form.php:110
|
82 |
+
msgid "ID"
|
83 |
+
msgstr ""
|
84 |
+
|
85 |
+
#: ../includes/form.php:111
|
86 |
+
msgid "Author"
|
87 |
+
msgstr ""
|
88 |
+
|
89 |
+
#: ../includes/form.php:113
|
90 |
+
msgid "Date"
|
91 |
+
msgstr ""
|
92 |
+
|
93 |
+
#: ../includes/form.php:114
|
94 |
+
msgid "Modified"
|
95 |
+
msgstr ""
|
96 |
+
|
97 |
+
#: ../includes/form.php:115
|
98 |
+
msgid "Random"
|
99 |
+
msgstr ""
|
100 |
+
|
101 |
+
#: ../includes/form.php:116
|
102 |
+
msgid "Comment Count"
|
103 |
+
msgstr ""
|
104 |
+
|
105 |
+
#: ../includes/form.php:117
|
106 |
+
msgid "Menu Order"
|
107 |
+
msgstr ""
|
108 |
+
|
109 |
+
#: ../includes/form.php:123
|
110 |
+
msgid "Limit to Category"
|
111 |
+
msgstr ""
|
112 |
+
|
113 |
+
#: ../includes/form.php:139
|
114 |
+
msgid "Limit to Tag"
|
115 |
+
msgstr ""
|
116 |
+
|
117 |
+
#: ../includes/form.php:155
|
118 |
+
msgid "Limit to Taxonomy"
|
119 |
+
msgstr ""
|
120 |
+
|
121 |
+
#: ../includes/form.php:158
|
122 |
+
msgid "Ex: category=1,2,4&post_tag=6,12"
|
123 |
+
msgstr ""
|
124 |
+
|
125 |
+
#: ../includes/form.php:159
|
126 |
+
msgid "Available: "
|
127 |
+
msgstr ""
|
128 |
+
|
129 |
+
#: ../includes/form.php:168
|
130 |
+
msgid "Number of posts to show"
|
131 |
+
msgstr ""
|
132 |
+
|
133 |
+
#: ../includes/form.php:175
|
134 |
+
msgid "Offset"
|
135 |
+
msgstr ""
|
136 |
+
|
137 |
+
#: ../includes/form.php:178
|
138 |
+
msgid "The number of posts to skip"
|
139 |
+
msgstr ""
|
140 |
+
|
141 |
+
#: ../includes/form.php:186
|
142 |
+
msgid "Display Thumbnail"
|
143 |
+
msgstr ""
|
144 |
+
|
145 |
+
#: ../includes/form.php:192
|
146 |
+
msgid "Thumbnail (width,height,align)"
|
147 |
+
msgstr ""
|
148 |
+
|
149 |
+
#: ../includes/form.php:197
|
150 |
+
msgid "Left"
|
151 |
+
msgstr ""
|
152 |
+
|
153 |
+
#: ../includes/form.php:198
|
154 |
+
msgid "Right"
|
155 |
+
msgstr ""
|
156 |
+
|
157 |
+
#: ../includes/form.php:199
|
158 |
+
msgid "Center"
|
159 |
+
msgstr ""
|
160 |
+
|
161 |
+
#: ../includes/form.php:205
|
162 |
+
msgid "Default Thumbnail"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
#: ../includes/form.php:208
|
166 |
+
msgid "Leave it blank to disable."
|
167 |
+
msgstr ""
|
168 |
+
|
169 |
+
#: ../includes/form.php:216
|
170 |
+
msgid "Display Excerpt"
|
171 |
+
msgstr ""
|
172 |
+
|
173 |
+
#: ../includes/form.php:222
|
174 |
+
msgid "Excerpt Length"
|
175 |
+
msgstr ""
|
176 |
+
|
177 |
+
#: ../includes/form.php:230
|
178 |
+
msgid "Display Readmore"
|
179 |
+
msgstr ""
|
180 |
+
|
181 |
+
#: ../includes/form.php:236
|
182 |
+
msgid "Readmore Text"
|
183 |
+
msgstr ""
|
184 |
+
|
185 |
+
#: ../includes/form.php:244
|
186 |
+
msgid "Display Date"
|
187 |
+
msgstr ""
|
188 |
+
|
189 |
+
#: ../includes/form.php:254
|
190 |
+
msgid "Custom CSS"
|
191 |
+
msgstr ""
|
192 |
+
|
193 |
+
#: ../includes/form.php:257
|
194 |
+
msgid ""
|
195 |
+
"If you turn off the default styles, you can use these css code to customize "
|
196 |
+
"the recent posts style."
|
197 |
+
msgstr ""
|
198 |
+
|
199 |
+
#: ../includes/functions.php:22
|
200 |
+
msgid "Recent Posts"
|
201 |
+
msgstr ""
|
202 |
+
|
203 |
+
#: ../includes/functions.php:45
|
204 |
+
msgid "Read More »"
|
205 |
+
msgstr ""
|
206 |
+
|
207 |
+
#: ../includes/functions.php:151
|
208 |
+
#, php-format
|
209 |
+
msgid "Permalink to %s"
|
210 |
+
msgstr ""
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
Contributors: satrya, themejunkie
|
3 |
Donate link: http://satrya.me/donate/
|
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: 3.
|
6 |
Tested up to: 4.0
|
7 |
-
Stable tag: 0.9.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -21,7 +21,8 @@ This plugin will enable a custom, flexible and super advanced recent posts, you
|
|
21 |
* Taxonomy support!
|
22 |
* Post status option.
|
23 |
* Custom html or text before and/or after recent posts.
|
24 |
-
* Added some filter to allow dev to customize the plugin. Please read [FAQ](http://wordpress.org/plugins/recent-posts-widget-extended/faq)
|
|
|
25 |
|
26 |
= Features Include =
|
27 |
|
@@ -42,20 +43,6 @@ This plugin will enable a custom, flexible and super advanced recent posts, you
|
|
42 |
* [Get the Image](http://wordpress.org/plugins/get-the-image/).
|
43 |
* [Page Builder by SiteOrigin](http://wordpress.org/plugins/siteorigin-panels/).
|
44 |
|
45 |
-
= Image Sizes Issue =
|
46 |
-
|
47 |
-
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 fix the image sizes.
|
48 |
-
|
49 |
-
= Tested Themes =
|
50 |
-
|
51 |
-
* [Twenty Eleven](http://wordpress.org/themes/twentyeleven)
|
52 |
-
* [Twenty Twelve](http://wordpress.org/themes/twentytwelve)
|
53 |
-
* [Twenty Fourteen](http://wordpress.org/themes/twentyfourteen)
|
54 |
-
* [Stargazer](http://wordpress.org/themes/stargazer)
|
55 |
-
* [Satu](http://wordpress.org/themes/satu)
|
56 |
-
* [Tiga](http://wordpress.org/themes/tiga)
|
57 |
-
* [Skyfall](http://wordpress.org/themes/skyfall)
|
58 |
-
|
59 |
= Support =
|
60 |
|
61 |
* Go to [forum support](http://wordpress.org/support/plugin/recent-posts-widget-extended).
|
@@ -112,9 +99,6 @@ function your_custom_function( $args ) {
|
|
112 |
= How to filter the post excerpt? =
|
113 |
Post excerpt now comes with filter to easily dev to change/customize it. `apply_filters( 'rpwe_excerpt', get_the_excerpt() )`
|
114 |
|
115 |
-
= Thumbnail size option not working properly =
|
116 |
-
Yes, this is because the plugin uses `the_post_thumbnail` custom sizes and not uses `add_image_size` function, [more information](http://codex.wordpress.org/Function_Reference/the_post_thumbnail). At the moment I have no idea how to fix this issue.
|
117 |
-
|
118 |
= Ordering not working! =
|
119 |
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)
|
120 |
|
@@ -187,7 +171,7 @@ First, please uncheck the **Use Default Style** option then place the css code b
|
|
187 |
`
|
188 |
|
189 |
= Why so many !important in the css code? =
|
190 |
-
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
|
191 |
|
192 |
= Available filters =
|
193 |
Default arguments
|
@@ -265,18 +249,9 @@ after=""
|
|
265 |
|
266 |
== Changelog ==
|
267 |
|
268 |
-
= 0.9.
|
269 |
-
*
|
270 |
-
|
271 |
-
|
272 |
-
*
|
273 |
-
* **
|
274 |
-
* After some research, I decided to get back the `get_the_excerpt()` as the excerpt. But now you can easily to change it via filter. Please read [FAQ](http://wordpress.org/plugins/recent-posts-widget-extended/faq)
|
275 |
-
* Added: Shortcode support.
|
276 |
-
* Added: Post status option.
|
277 |
-
* Added: Taxonomy input to limit the posts based on taxonomy.
|
278 |
-
* Added: Exclude sticky post.
|
279 |
-
* Added: You can display HTML or text before or after the posts.
|
280 |
-
* Added: Now support Siteorigin Page Builder.
|
281 |
-
* Removed: Suppres Filter option
|
282 |
-
* Limit to Category and Limit to Tag option will be removed in the next release, please just use the **Limit to Taxonomy** option to display posts based on taxonomy.
|
2 |
Contributors: satrya, themejunkie
|
3 |
Donate link: http://satrya.me/donate/
|
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: 3.7
|
6 |
Tested up to: 4.0
|
7 |
+
Stable tag: 0.9.6
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
21 |
* Taxonomy support!
|
22 |
* Post status option.
|
23 |
* Custom html or text before and/or after recent posts.
|
24 |
+
* Added some filter to allow dev to customize the plugin. Please read [FAQ](http://wordpress.org/plugins/recent-posts-widget-extended/faq).
|
25 |
+
* Better image cropping.
|
26 |
|
27 |
= Features Include =
|
28 |
|
43 |
* [Get the Image](http://wordpress.org/plugins/get-the-image/).
|
44 |
* [Page Builder by SiteOrigin](http://wordpress.org/plugins/siteorigin-panels/).
|
45 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
46 |
= Support =
|
47 |
|
48 |
* Go to [forum support](http://wordpress.org/support/plugin/recent-posts-widget-extended).
|
99 |
= How to filter the post excerpt? =
|
100 |
Post excerpt now comes with filter to easily dev to change/customize it. `apply_filters( 'rpwe_excerpt', get_the_excerpt() )`
|
101 |
|
|
|
|
|
|
|
102 |
= Ordering not working! =
|
103 |
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)
|
104 |
|
171 |
`
|
172 |
|
173 |
= Why so many !important in the css code? =
|
174 |
+
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.
|
175 |
|
176 |
= Available filters =
|
177 |
Default arguments
|
249 |
|
250 |
== Changelog ==
|
251 |
|
252 |
+
= 0.9.6 - 9/09/2014 =
|
253 |
+
* **Add:** Now, you can display posts from multiple post types.
|
254 |
+
* **Fix:** **Limit to Category** and **Limit to Tag** not working issue.
|
255 |
+
* **Improve:** Change multi select with checkbox for **Limit to Category** and **Limit to Tag** option for better user experience.
|
256 |
+
* **Experiment:** Better image cropping using [Aqua Resizer](https://github.com/syamilmj/Aqua-Resizer). It should fixed thumbnail not cropping correctly issue.
|
257 |
+
* **Update:** Language
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rpwe.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Recent Posts Widget Extended
|
4 |
* Plugin URI: http://satrya.me/wordpress-plugins/recent-posts-widget-extended/
|
5 |
* Description: Enables advanced widget that gives you total control over the output of your site’s most recent Posts.
|
6 |
-
* Version: 0.9.
|
7 |
* Author: Satrya
|
8 |
* Author URI: http://satrya.me/
|
9 |
* Author Email: satrya@satrya.me
|
@@ -96,6 +96,7 @@ class RPW_Extended {
|
|
96 |
* @since 0.1
|
97 |
*/
|
98 |
public function includes() {
|
|
|
99 |
require_once( RPWE_INCLUDES . 'functions.php' );
|
100 |
require_once( RPWE_INCLUDES . 'shortcode.php' );
|
101 |
}
|
@@ -106,15 +107,8 @@ class RPW_Extended {
|
|
106 |
* @since 0.8
|
107 |
*/
|
108 |
public function admin_style() {
|
109 |
-
|
110 |
-
// Check if current screen is Widgets page.
|
111 |
-
if ( 'widgets' != get_current_screen()->base ) {
|
112 |
-
return;
|
113 |
-
}
|
114 |
-
|
115 |
// Loads the widget style.
|
116 |
wp_enqueue_style( 'rpwe-admin-style', trailingslashit( RPWE_ASSETS ) . 'css/rpwe-admin.css', null, null );
|
117 |
-
|
118 |
}
|
119 |
|
120 |
/**
|
3 |
* Plugin Name: Recent Posts Widget Extended
|
4 |
* Plugin URI: http://satrya.me/wordpress-plugins/recent-posts-widget-extended/
|
5 |
* Description: Enables advanced widget that gives you total control over the output of your site’s most recent Posts.
|
6 |
+
* Version: 0.9.6
|
7 |
* Author: Satrya
|
8 |
* Author URI: http://satrya.me/
|
9 |
* Author Email: satrya@satrya.me
|
96 |
* @since 0.1
|
97 |
*/
|
98 |
public function includes() {
|
99 |
+
require_once( RPWE_INCLUDES . 'aq_resizer.php' );
|
100 |
require_once( RPWE_INCLUDES . 'functions.php' );
|
101 |
require_once( RPWE_INCLUDES . 'shortcode.php' );
|
102 |
}
|
107 |
* @since 0.8
|
108 |
*/
|
109 |
public function admin_style() {
|
|
|
|
|
|
|
|
|
|
|
|
|
110 |
// Loads the widget style.
|
111 |
wp_enqueue_style( 'rpwe-admin-style', trailingslashit( RPWE_ASSETS ) . 'css/rpwe-admin.css', null, null );
|
|
|
112 |
}
|
113 |
|
114 |
/**
|