Recent Posts Widget Extended - Version 0.9.8

Version Description

  • 26/11/2014
Download this release

Release Info

Developer satrya
Plugin Icon 128x128 Recent Posts Widget Extended
Version 0.9.8
Comparing to
See all releases

Code changes from version 0.9.7 to 0.9.8

assets/css/rpwe-admin.css CHANGED
@@ -1,48 +1,48 @@
1
- .widgets-php .rpwe-columns-3 {
2
- overflow: hidden;
3
- float: left;
4
- width: 31%;
5
- margin-right: 3.5%;
6
- }
7
-
8
- .widgets-php .rpwe-columns-3 select.widefat {
9
- width: 98.5%;
10
- }
11
-
12
- .widgets-php .rpwe-column-last {
13
- float: right;
14
- margin-right: 0;
15
- }
16
-
17
- .widgets-php .rpwe-columns-3 label {
18
- font-size: 11px;
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
+ .widgets-php .rpwe-columns-3 {
2
+ overflow: hidden;
3
+ float: left;
4
+ width: 31%;
5
+ margin-right: 3.5%;
6
+ }
7
+
8
+ .widgets-php .rpwe-columns-3 select.widefat {
9
+ width: 98.5%;
10
+ }
11
+
12
+ .widgets-php .rpwe-column-last {
13
+ float: right;
14
+ margin-right: 0;
15
+ }
16
+
17
+ .widgets-php .rpwe-columns-3 label {
18
+ font-size: 11px;
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
  }
classes/widget.php CHANGED
@@ -1,151 +1,151 @@
1
- <?php
2
- /**
3
- * The custom recent posts widget.
4
- * This widget gives total control over the output to the user.
5
- *
6
- * @package Recent_Posts_Widget_Extended
7
- * @since 0.1
8
- * @author Satrya
9
- * @copyright Copyright (c) 2014, Satrya
10
- * @license http://www.gnu.org/licenses/gpl-2.0.html
11
- */
12
- class Recent_Posts_Widget_Extended extends WP_Widget {
13
-
14
- /**
15
- * Sets up the widgets.
16
- *
17
- * @since 0.1
18
- */
19
- function __construct() {
20
-
21
- /* Set up the widget options. */
22
- $widget_options = array(
23
- 'classname' => 'rpwe_widget recent-posts-extended',
24
- 'description' => __( 'An advanced widget that gives you total control over the output of your site’s most recent Posts.', 'rpwe' )
25
- );
26
-
27
- $control_options = array(
28
- 'width' => 750,
29
- 'height' => 350
30
- );
31
-
32
- /* Create the widget. */
33
- $this->WP_Widget(
34
- 'rpwe_widget', // $this->id_base
35
- __( 'Recent Posts Extended', 'rpwe' ), // $this->name
36
- $widget_options, // $this->widget_options
37
- $control_options // $this->control_options
38
- );
39
-
40
- }
41
-
42
- /**
43
- * Outputs the widget based on the arguments input through the widget controls.
44
- *
45
- * @since 0.1
46
- */
47
- function widget( $args, $instance ) {
48
- extract( $args );
49
-
50
- $recent = rpwe_get_recent_posts( $instance );
51
-
52
- if ( $recent ) {
53
-
54
- // Output the theme's $before_widget wrapper.
55
- echo $before_widget;
56
-
57
- // If both title and title url is not empty, display it.
58
- if ( ! empty( $instance['title_url'] ) && ! empty( $instance['title'] ) ) {
59
- 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;
60
-
61
- // If the title not empty, display it.
62
- } elseif ( ! empty( $instance['title'] ) ) {
63
- echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
64
- }
65
-
66
- // Get the recent posts query.
67
- echo $recent;
68
-
69
- // Close the theme's widget wrapper.
70
- echo $after_widget;
71
-
72
- }
73
-
74
- }
75
-
76
- /**
77
- * Updates the widget control options for the particular instance of the widget.
78
- *
79
- * @since 0.1
80
- */
81
- function update( $new_instance, $old_instance ) {
82
-
83
- // Validate post_type submissions
84
- $name = get_post_types( array( 'public' => true ), 'names' );
85
- $types = array();
86
- foreach( $new_instance['post_type'] as $type ) {
87
- if ( in_array( $type, $name ) ) {
88
- $types[] = $type;
89
- }
90
- }
91
- if ( empty( $types ) ) {
92
- $types[] = 'post';
93
- }
94
-
95
- $instance = $old_instance;
96
- $instance['title'] = strip_tags( $new_instance['title'] );
97
- $instance['title_url'] = esc_url( $new_instance['title_url'] );
98
-
99
- $instance['ignore_sticky'] = isset( $new_instance['ignore_sticky'] ) ? (bool) $new_instance['ignore_sticky'] : 0;
100
- $instance['limit'] = (int)( $new_instance['limit'] );
101
- $instance['offset'] = (int)( $new_instance['offset'] );
102
- $instance['order'] = $new_instance['order'];
103
- $instance['orderby'] = $new_instance['orderby'];
104
- $instance['post_type'] = $types;
105
- $instance['post_status'] = esc_attr( $new_instance['post_status'] );
106
- $instance['cat'] = $new_instance['cat'];
107
- $instance['tag'] = $new_instance['tag'];
108
- $instance['taxonomy'] = esc_attr( $new_instance['taxonomy'] );
109
-
110
- $instance['excerpt'] = isset( $new_instance['excerpt'] ) ? (bool) $new_instance['excerpt'] : false;
111
- $instance['length'] = (int)( $new_instance['length'] );
112
- $instance['date'] = isset( $new_instance['date'] ) ? (bool) $new_instance['date'] : false;
113
- $instance['date_relative'] = isset( $new_instance['date_relative'] ) ? (bool) $new_instance['date_relative'] : false;
114
- $instance['readmore'] = isset( $new_instance['readmore'] ) ? (bool) $new_instance['readmore'] : false;
115
- $instance['readmore_text'] = strip_tags( $new_instance['readmore_text'] );
116
-
117
- $instance['thumb'] = isset( $new_instance['thumb'] ) ? (bool) $new_instance['thumb'] : false;
118
- $instance['thumb_height'] = (int)( $new_instance['thumb_height'] );
119
- $instance['thumb_width'] = (int)( $new_instance['thumb_width'] );
120
- $instance['thumb_default'] = esc_url( $new_instance['thumb_default'] );
121
- $instance['thumb_align'] = esc_attr( $new_instance['thumb_align'] );
122
-
123
- $instance['styles_default'] = isset( $new_instance['styles_default'] ) ? (bool) $new_instance['styles_default'] : false;
124
- $instance['cssID'] = sanitize_html_class( $new_instance['cssID'] );
125
- $instance['css'] = $new_instance['css'];
126
- $instance['before'] = wp_filter_post_kses( $new_instance['before'] );
127
- $instance['after'] = wp_filter_post_kses( $new_instance['after'] );
128
-
129
- return $instance;
130
-
131
- }
132
-
133
- /**
134
- * Displays the widget control options in the Widgets admin screen.
135
- *
136
- * @since 0.1
137
- */
138
- function form( $instance ) {
139
-
140
- // Merge the user-selected arguments with the defaults.
141
- $instance = wp_parse_args( (array) $instance, rpwe_get_default_args() );
142
-
143
- // Extract the array to allow easy use of variables.
144
- extract( $instance );
145
-
146
- // Loads the widget form.
147
- include( RPWE_INCLUDES . 'form.php' );
148
-
149
- }
150
-
151
  }
1
+ <?php
2
+ /**
3
+ * The custom recent posts widget.
4
+ * This widget gives total control over the output to the user.
5
+ *
6
+ * @package Recent_Posts_Widget_Extended
7
+ * @since 0.1
8
+ * @author Satrya
9
+ * @copyright Copyright (c) 2014, Satrya
10
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
11
+ */
12
+ class Recent_Posts_Widget_Extended extends WP_Widget {
13
+
14
+ /**
15
+ * Sets up the widgets.
16
+ *
17
+ * @since 0.1
18
+ */
19
+ function __construct() {
20
+
21
+ /* Set up the widget options. */
22
+ $widget_options = array(
23
+ 'classname' => 'rpwe_widget recent-posts-extended',
24
+ 'description' => __( 'An advanced widget that gives you total control over the output of your site’s most recent Posts.', 'rpwe' )
25
+ );
26
+
27
+ $control_options = array(
28
+ 'width' => 750,
29
+ 'height' => 350
30
+ );
31
+
32
+ /* Create the widget. */
33
+ $this->WP_Widget(
34
+ 'rpwe_widget', // $this->id_base
35
+ __( 'Recent Posts Extended', 'rpwe' ), // $this->name
36
+ $widget_options, // $this->widget_options
37
+ $control_options // $this->control_options
38
+ );
39
+
40
+ }
41
+
42
+ /**
43
+ * Outputs the widget based on the arguments input through the widget controls.
44
+ *
45
+ * @since 0.1
46
+ */
47
+ function widget( $args, $instance ) {
48
+ extract( $args );
49
+
50
+ $recent = rpwe_get_recent_posts( $instance );
51
+
52
+ if ( $recent ) {
53
+
54
+ // Output the theme's $before_widget wrapper.
55
+ echo $before_widget;
56
+
57
+ // If both title and title url is not empty, display it.
58
+ if ( ! empty( $instance['title_url'] ) && ! empty( $instance['title'] ) ) {
59
+ 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;
60
+
61
+ // If the title not empty, display it.
62
+ } elseif ( ! empty( $instance['title'] ) ) {
63
+ echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title;
64
+ }
65
+
66
+ // Get the recent posts query.
67
+ echo $recent;
68
+
69
+ // Close the theme's widget wrapper.
70
+ echo $after_widget;
71
+
72
+ }
73
+
74
+ }
75
+
76
+ /**
77
+ * Updates the widget control options for the particular instance of the widget.
78
+ *
79
+ * @since 0.1
80
+ */
81
+ function update( $new_instance, $old_instance ) {
82
+
83
+ // Validate post_type submissions
84
+ $name = get_post_types( array( 'public' => true ), 'names' );
85
+ $types = array();
86
+ foreach( $new_instance['post_type'] as $type ) {
87
+ if ( in_array( $type, $name ) ) {
88
+ $types[] = $type;
89
+ }
90
+ }
91
+ if ( empty( $types ) ) {
92
+ $types[] = 'post';
93
+ }
94
+
95
+ $instance = $old_instance;
96
+ $instance['title'] = strip_tags( $new_instance['title'] );
97
+ $instance['title_url'] = esc_url( $new_instance['title_url'] );
98
+
99
+ $instance['ignore_sticky'] = isset( $new_instance['ignore_sticky'] ) ? (bool) $new_instance['ignore_sticky'] : 0;
100
+ $instance['limit'] = (int)( $new_instance['limit'] );
101
+ $instance['offset'] = (int)( $new_instance['offset'] );
102
+ $instance['order'] = $new_instance['order'];
103
+ $instance['orderby'] = $new_instance['orderby'];
104
+ $instance['post_type'] = $types;
105
+ $instance['post_status'] = esc_attr( $new_instance['post_status'] );
106
+ $instance['cat'] = $new_instance['cat'];
107
+ $instance['tag'] = $new_instance['tag'];
108
+ $instance['taxonomy'] = esc_attr( $new_instance['taxonomy'] );
109
+
110
+ $instance['excerpt'] = isset( $new_instance['excerpt'] ) ? (bool) $new_instance['excerpt'] : false;
111
+ $instance['length'] = (int)( $new_instance['length'] );
112
+ $instance['date'] = isset( $new_instance['date'] ) ? (bool) $new_instance['date'] : false;
113
+ $instance['date_relative'] = isset( $new_instance['date_relative'] ) ? (bool) $new_instance['date_relative'] : false;
114
+ $instance['readmore'] = isset( $new_instance['readmore'] ) ? (bool) $new_instance['readmore'] : false;
115
+ $instance['readmore_text'] = strip_tags( $new_instance['readmore_text'] );
116
+
117
+ $instance['thumb'] = isset( $new_instance['thumb'] ) ? (bool) $new_instance['thumb'] : false;
118
+ $instance['thumb_height'] = (int)( $new_instance['thumb_height'] );
119
+ $instance['thumb_width'] = (int)( $new_instance['thumb_width'] );
120
+ $instance['thumb_default'] = esc_url( $new_instance['thumb_default'] );
121
+ $instance['thumb_align'] = esc_attr( $new_instance['thumb_align'] );
122
+
123
+ $instance['styles_default'] = isset( $new_instance['styles_default'] ) ? (bool) $new_instance['styles_default'] : false;
124
+ $instance['cssID'] = sanitize_html_class( $new_instance['cssID'] );
125
+ $instance['css'] = $new_instance['css'];
126
+ $instance['before'] = stripslashes( $new_instance['before'] );
127
+ $instance['after'] = stripslashes( $new_instance['after'] );
128
+
129
+ return $instance;
130
+
131
+ }
132
+
133
+ /**
134
+ * Displays the widget control options in the Widgets admin screen.
135
+ *
136
+ * @since 0.1
137
+ */
138
+ function form( $instance ) {
139
+
140
+ // Merge the user-selected arguments with the defaults.
141
+ $instance = wp_parse_args( (array) $instance, rpwe_get_default_args() );
142
+
143
+ // Extract the array to allow easy use of variables.
144
+ extract( $instance );
145
+
146
+ // Loads the widget form.
147
+ include( RPWE_INCLUDES . 'form.php' );
148
+
149
+ }
150
+
151
  }
includes/form.php CHANGED
@@ -1,264 +1,264 @@
1
- <?php
2
- /**
3
- * Widget forms.
4
- *
5
- * @package Recent_Posts_Widget_Extended
6
- * @since 0.9.4
7
- * @author Satrya
8
- * @copyright Copyright (c) 2014, Satrya
9
- * @license http://www.gnu.org/licenses/gpl-2.0.html
10
- */
11
- ?>
12
-
13
- <div class="rpwe-columns-3">
14
-
15
- <p>
16
- <label for="<?php echo $this->get_field_id( 'title' ); ?>">
17
- <?php _e( 'Title', 'rpwe' ); ?>
18
- </label>
19
- <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'] ); ?>" />
20
- </p>
21
-
22
- <p>
23
- <label for="<?php echo $this->get_field_id( 'title_url' ); ?>">
24
- <?php _e( 'Title URL', 'rpwe' ); ?>
25
- </label>
26
- <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'] ); ?>" />
27
- </p>
28
-
29
- <p>
30
- <label for="<?php echo $this->get_field_id( 'cssID' ); ?>">
31
- <?php _e( 'CSS ID', 'rpwe' ); ?>
32
- </label>
33
- <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'] ); ?>"/>
34
- </p>
35
-
36
- <p>
37
- <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'] ); ?> />
38
- <label class="input-checkbox" for="<?php echo $this->get_field_id( 'styles_default' ); ?>">
39
- <?php _e( 'Use Default Styles', 'rpwe' ); ?>
40
- </label>
41
- </p>
42
-
43
- <p>
44
- <label for="<?php echo $this->get_field_id( 'before' ); ?>">
45
- <?php _e( 'HTML or text before the recent posts', 'rpwe' );?>
46
- </label>
47
- <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>
48
- </p>
49
-
50
- <p>
51
- <label for="<?php echo $this->get_field_id( 'after' ); ?>">
52
- <?php _e( 'HTML or text after the recent posts', 'rpwe' );?>
53
- </label>
54
- <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>
55
- </p>
56
-
57
- </div>
58
-
59
- <div class="rpwe-columns-3">
60
-
61
- <p>
62
- <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' ); ?>" />
63
- <label for="<?php echo $this->get_field_id( 'ignore_sticky' ); ?>">
64
- <?php _e( 'Ignore sticky posts', 'rpwe' ); ?>
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' ); ?>">
86
- <?php _e( 'Post Status', 'rpwe' ); ?>
87
- </label>
88
- <select class="widefat" id="<?php echo $this->get_field_id( 'post_status' ); ?>" name="<?php echo $this->get_field_name( 'post_status' ); ?>" style="width:100%;">
89
- <?php foreach ( get_available_post_statuses() as $status_value => $status_label ) { ?>
90
- <option value="<?php echo esc_attr( $status_label ); ?>" <?php selected( $instance['post_status'], $status_label ); ?>><?php echo esc_html( ucfirst( $status_label ) ); ?></option>
91
- <?php } ?>
92
- </select>
93
- </p>
94
-
95
- <p>
96
- <label for="<?php echo $this->get_field_id( 'order' ); ?>">
97
- <?php _e( 'Order', 'rpwe' ); ?>
98
- </label>
99
- <select class="widefat" id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>" style="width:100%;">
100
- <option value="DESC" <?php selected( $instance['order'], 'DESC' ); ?>><?php _e( 'Descending', 'rpwe' ) ?></option>
101
- <option value="ASC" <?php selected( $instance['order'], 'ASC' ); ?>><?php _e( 'Ascending', 'rpwe' ) ?></option>
102
- </select>
103
- </p>
104
-
105
- <p>
106
- <label for="<?php echo $this->get_field_id( 'orderby' ); ?>">
107
- <?php _e( 'Orderby', 'rpwe' ); ?>
108
- </label>
109
- <select class="widefat" id="<?php echo $this->get_field_id( 'orderby' ); ?>" name="<?php echo $this->get_field_name( 'orderby' ); ?>" style="width:100%;">
110
- <option value="ID" <?php selected( $instance['orderby'], 'ID' ); ?>><?php _e( 'ID', 'rpwe' ) ?></option>
111
- <option value="author" <?php selected( $instance['orderby'], 'author' ); ?>><?php _e( 'Author', 'rpwe' ) ?></option>
112
- <option value="title" <?php selected( $instance['orderby'], 'title' ); ?>><?php _e( 'Title', 'rpwe' ) ?></option>
113
- <option value="date" <?php selected( $instance['orderby'], 'date' ); ?>><?php _e( 'Date', 'rpwe' ) ?></option>
114
- <option value="modified" <?php selected( $instance['orderby'], 'modified' ); ?>><?php _e( 'Modified', 'rpwe' ) ?></option>
115
- <option value="rand" <?php selected( $instance['orderby'], 'rand' ); ?>><?php _e( 'Random', 'rpwe' ) ?></option>
116
- <option value="comment_count" <?php selected( $instance['orderby'], 'comment_count' ); ?>><?php _e( 'Comment Count', 'rpwe' ) ?></option>
117
- <option value="menu_order" <?php selected( $instance['orderby'], 'menu_order' ); ?>><?php _e( 'Menu Order', 'rpwe' ) ?></option>
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' ); ?>">
155
- <?php _e( 'Limit to Taxonomy', 'rpwe' ); ?>
156
- </label>
157
- <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'] ); ?>" />
158
- <small><?php _e( 'Ex: category=1,2,4&amp;post_tag=6,12', 'rpwe' );?><br />
159
- <?php _e( 'Available: ', 'rpwe' ); echo implode( ', ', get_taxonomies( array( 'public' => true ) ) ); ?></small>
160
- </p>
161
-
162
- </div>
163
-
164
- <div class="rpwe-columns-3 rpwe-column-last">
165
-
166
- <p>
167
- <label for="<?php echo $this->get_field_id( 'limit' ); ?>">
168
- <?php _e( 'Number of posts to show', 'rpwe' ); ?>
169
- </label>
170
- <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'] ); ?>" />
171
- </p>
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' ) ) { ?>
182
-
183
- <p>
184
- <input id="<?php echo $this->get_field_id( 'thumb' ); ?>" name="<?php echo $this->get_field_name( 'thumb' ); ?>" type="checkbox" <?php checked( $instance['thumb'] ); ?> />
185
- <label class="input-checkbox" for="<?php echo $this->get_field_id( 'thumb' ); ?>">
186
- <?php _e( 'Display Thumbnail', 'rpwe' ); ?>
187
- </label>
188
- </p>
189
-
190
- <p>
191
- <label class="rpwe-block" for="<?php echo $this->get_field_id( 'thumb_height' ); ?>">
192
- <?php _e( 'Thumbnail (height,width,align)', 'rpwe' ); ?>
193
- </label>
194
- <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'] ); ?>" />
195
- <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'] ); ?>"/>
196
- <select class="small-input" id="<?php echo $this->get_field_id( 'thumb_align' ); ?>" name="<?php echo $this->get_field_name( 'thumb_align' ); ?>">
197
- <option value="rpwe-alignleft" <?php selected( $instance['thumb_align'], 'rpwe-alignleft' ); ?>><?php _e( 'Left', 'rpwe' ) ?></option>
198
- <option value="rpwe-alignright" <?php selected( $instance['thumb_align'], 'rpwe-alignright' ); ?>><?php _e( 'Right', 'rpwe' ) ?></option>
199
- <option value="rpwe-aligncenter" <?php selected( $instance['thumb_align'], 'rpwe-aligncenter' ); ?>><?php _e( 'Center', 'rpwe' ) ?></option>
200
- </select>
201
- </p>
202
-
203
- <p>
204
- <label for="<?php echo $this->get_field_id( 'thumb_default' ); ?>">
205
- <?php _e( 'Default Thumbnail', 'rpwe' ); ?>
206
- </label>
207
- <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']; ?>"/>
208
- <small><?php _e( 'Leave it blank to disable.', 'rpwe' ); ?></small>
209
- </p>
210
-
211
- <?php } ?>
212
-
213
- <p>
214
- <input id="<?php echo $this->get_field_id( 'excerpt' ); ?>" name="<?php echo $this->get_field_name( 'excerpt' ); ?>" type="checkbox" <?php checked( $instance['excerpt'] ); ?> />
215
- <label class="input-checkbox" for="<?php echo $this->get_field_id( 'excerpt' ); ?>">
216
- <?php _e( 'Display Excerpt', 'rpwe' ); ?>
217
- </label>
218
- </p>
219
-
220
- <p>
221
- <label for="<?php echo $this->get_field_id( 'length' ); ?>">
222
- <?php _e( 'Excerpt Length', 'rpwe' ); ?>
223
- </label>
224
- <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'] ); ?>" />
225
- </p>
226
-
227
- <p>
228
- <input id="<?php echo $this->get_field_id( 'readmore' ); ?>" name="<?php echo $this->get_field_name( 'readmore' ); ?>" type="checkbox" <?php checked( $instance['readmore'] ); ?> />
229
- <label class="input-checkbox" for="<?php echo $this->get_field_id( 'readmore' ); ?>">
230
- <?php _e( 'Display Readmore', 'rpwe' ); ?>
231
- </label>
232
- </p>
233
-
234
- <p>
235
- <label for="<?php echo $this->get_field_id( 'readmore_text' ); ?>">
236
- <?php _e( 'Readmore Text', 'rpwe' ); ?>
237
- </label>
238
- <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'] ); ?>" />
239
- </p>
240
-
241
- <p>
242
- <input id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" type="checkbox" <?php checked( $instance['date'] ); ?> />
243
- <label class="input-checkbox" for="<?php echo $this->get_field_id( 'date' ); ?>">
244
- <?php _e( 'Display Date', 'rpwe' ); ?>
245
- </label>
246
- </p>
247
- <p>
248
- <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'] ); ?> />
249
- <label for="<?php echo $this->get_field_id( 'date_relative' ); ?>">
250
- <?php _e( 'Use Relative Date. eg: 5 days ago', 'rpwe' ); ?>
251
- </label>
252
- </p>
253
-
254
- </div>
255
-
256
- <div class="clear"></div>
257
-
258
- <p>
259
- <label for="<?php echo $this->get_field_id( 'css' ); ?>">
260
- <?php _e( 'Custom CSS', 'rpwe' ); ?>
261
- </label>
262
- <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>
263
- <small><?php _e( 'If you turn off the default styles, you can use these css code to customize the recent posts style.', 'rpwe' ); ?></small>
264
  </p>
1
+ <?php
2
+ /**
3
+ * Widget forms.
4
+ *
5
+ * @package Recent_Posts_Widget_Extended
6
+ * @since 0.9.4
7
+ * @author Satrya
8
+ * @copyright Copyright (c) 2014, Satrya
9
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
10
+ */
11
+ ?>
12
+
13
+ <div class="rpwe-columns-3">
14
+
15
+ <p>
16
+ <label for="<?php echo $this->get_field_id( 'title' ); ?>">
17
+ <?php _e( 'Title', 'rpwe' ); ?>
18
+ </label>
19
+ <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'] ); ?>" />
20
+ </p>
21
+
22
+ <p>
23
+ <label for="<?php echo $this->get_field_id( 'title_url' ); ?>">
24
+ <?php _e( 'Title URL', 'rpwe' ); ?>
25
+ </label>
26
+ <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'] ); ?>" />
27
+ </p>
28
+
29
+ <p>
30
+ <label for="<?php echo $this->get_field_id( 'cssID' ); ?>">
31
+ <?php _e( 'CSS ID', 'rpwe' ); ?>
32
+ </label>
33
+ <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'] ); ?>"/>
34
+ </p>
35
+
36
+ <p>
37
+ <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'] ); ?> />
38
+ <label class="input-checkbox" for="<?php echo $this->get_field_id( 'styles_default' ); ?>">
39
+ <?php _e( 'Use Default Styles', 'rpwe' ); ?>
40
+ </label>
41
+ </p>
42
+
43
+ <p>
44
+ <label for="<?php echo $this->get_field_id( 'before' ); ?>">
45
+ <?php _e( 'HTML or text before the recent posts', 'rpwe' );?>
46
+ </label>
47
+ <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>
48
+ </p>
49
+
50
+ <p>
51
+ <label for="<?php echo $this->get_field_id( 'after' ); ?>">
52
+ <?php _e( 'HTML or text after the recent posts', 'rpwe' );?>
53
+ </label>
54
+ <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>
55
+ </p>
56
+
57
+ </div>
58
+
59
+ <div class="rpwe-columns-3">
60
+
61
+ <p>
62
+ <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' ); ?>" />
63
+ <label for="<?php echo $this->get_field_id( 'ignore_sticky' ); ?>">
64
+ <?php _e( 'Ignore sticky posts', 'rpwe' ); ?>
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' ); ?>">
86
+ <?php _e( 'Post Status', 'rpwe' ); ?>
87
+ </label>
88
+ <select class="widefat" id="<?php echo $this->get_field_id( 'post_status' ); ?>" name="<?php echo $this->get_field_name( 'post_status' ); ?>" style="width:100%;">
89
+ <?php foreach ( get_available_post_statuses() as $status_value => $status_label ) { ?>
90
+ <option value="<?php echo esc_attr( $status_label ); ?>" <?php selected( $instance['post_status'], $status_label ); ?>><?php echo esc_html( ucfirst( $status_label ) ); ?></option>
91
+ <?php } ?>
92
+ </select>
93
+ </p>
94
+
95
+ <p>
96
+ <label for="<?php echo $this->get_field_id( 'order' ); ?>">
97
+ <?php _e( 'Order', 'rpwe' ); ?>
98
+ </label>
99
+ <select class="widefat" id="<?php echo $this->get_field_id( 'order' ); ?>" name="<?php echo $this->get_field_name( 'order' ); ?>" style="width:100%;">
100
+ <option value="DESC" <?php selected( $instance['order'], 'DESC' ); ?>><?php _e( 'Descending', 'rpwe' ) ?></option>
101
+ <option value="ASC" <?php selected( $instance['order'], 'ASC' ); ?>><?php _e( 'Ascending', 'rpwe' ) ?></option>
102
+ </select>
103
+ </p>
104
+
105
+ <p>
106
+ <label for="<?php echo $this->get_field_id( 'orderby' ); ?>">
107
+ <?php _e( 'Orderby', 'rpwe' ); ?>
108
+ </label>
109
+ <select class="widefat" id="<?php echo $this->get_field_id( 'orderby' ); ?>" name="<?php echo $this->get_field_name( 'orderby' ); ?>" style="width:100%;">
110
+ <option value="ID" <?php selected( $instance['orderby'], 'ID' ); ?>><?php _e( 'ID', 'rpwe' ) ?></option>
111
+ <option value="author" <?php selected( $instance['orderby'], 'author' ); ?>><?php _e( 'Author', 'rpwe' ) ?></option>
112
+ <option value="title" <?php selected( $instance['orderby'], 'title' ); ?>><?php _e( 'Title', 'rpwe' ) ?></option>
113
+ <option value="date" <?php selected( $instance['orderby'], 'date' ); ?>><?php _e( 'Date', 'rpwe' ) ?></option>
114
+ <option value="modified" <?php selected( $instance['orderby'], 'modified' ); ?>><?php _e( 'Modified', 'rpwe' ) ?></option>
115
+ <option value="rand" <?php selected( $instance['orderby'], 'rand' ); ?>><?php _e( 'Random', 'rpwe' ) ?></option>
116
+ <option value="comment_count" <?php selected( $instance['orderby'], 'comment_count' ); ?>><?php _e( 'Comment Count', 'rpwe' ) ?></option>
117
+ <option value="menu_order" <?php selected( $instance['orderby'], 'menu_order' ); ?>><?php _e( 'Menu Order', 'rpwe' ) ?></option>
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' ); ?>">
155
+ <?php _e( 'Limit to Taxonomy', 'rpwe' ); ?>
156
+ </label>
157
+ <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'] ); ?>" />
158
+ <small><?php _e( 'Ex: category=1,2,4&amp;post_tag=6,12', 'rpwe' );?><br />
159
+ <?php _e( 'Available: ', 'rpwe' ); echo implode( ', ', get_taxonomies( array( 'public' => true ) ) ); ?></small>
160
+ </p>
161
+
162
+ </div>
163
+
164
+ <div class="rpwe-columns-3 rpwe-column-last">
165
+
166
+ <p>
167
+ <label for="<?php echo $this->get_field_id( 'limit' ); ?>">
168
+ <?php _e( 'Number of posts to show', 'rpwe' ); ?>
169
+ </label>
170
+ <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'] ); ?>" />
171
+ </p>
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' ) ) { ?>
182
+
183
+ <p>
184
+ <input id="<?php echo $this->get_field_id( 'thumb' ); ?>" name="<?php echo $this->get_field_name( 'thumb' ); ?>" type="checkbox" <?php checked( $instance['thumb'] ); ?> />
185
+ <label class="input-checkbox" for="<?php echo $this->get_field_id( 'thumb' ); ?>">
186
+ <?php _e( 'Display Thumbnail', 'rpwe' ); ?>
187
+ </label>
188
+ </p>
189
+
190
+ <p>
191
+ <label class="rpwe-block" for="<?php echo $this->get_field_id( 'thumb_height' ); ?>">
192
+ <?php _e( 'Thumbnail (height,width,align)', 'rpwe' ); ?>
193
+ </label>
194
+ <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'] ); ?>" />
195
+ <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'] ); ?>"/>
196
+ <select class="small-input" id="<?php echo $this->get_field_id( 'thumb_align' ); ?>" name="<?php echo $this->get_field_name( 'thumb_align' ); ?>">
197
+ <option value="rpwe-alignleft" <?php selected( $instance['thumb_align'], 'rpwe-alignleft' ); ?>><?php _e( 'Left', 'rpwe' ) ?></option>
198
+ <option value="rpwe-alignright" <?php selected( $instance['thumb_align'], 'rpwe-alignright' ); ?>><?php _e( 'Right', 'rpwe' ) ?></option>
199
+ <option value="rpwe-aligncenter" <?php selected( $instance['thumb_align'], 'rpwe-aligncenter' ); ?>><?php _e( 'Center', 'rpwe' ) ?></option>
200
+ </select>
201
+ </p>
202
+
203
+ <p>
204
+ <label for="<?php echo $this->get_field_id( 'thumb_default' ); ?>">
205
+ <?php _e( 'Default Thumbnail', 'rpwe' ); ?>
206
+ </label>
207
+ <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']; ?>"/>
208
+ <small><?php _e( 'Leave it blank to disable.', 'rpwe' ); ?></small>
209
+ </p>
210
+
211
+ <?php } ?>
212
+
213
+ <p>
214
+ <input id="<?php echo $this->get_field_id( 'excerpt' ); ?>" name="<?php echo $this->get_field_name( 'excerpt' ); ?>" type="checkbox" <?php checked( $instance['excerpt'] ); ?> />
215
+ <label class="input-checkbox" for="<?php echo $this->get_field_id( 'excerpt' ); ?>">
216
+ <?php _e( 'Display Excerpt', 'rpwe' ); ?>
217
+ </label>
218
+ </p>
219
+
220
+ <p>
221
+ <label for="<?php echo $this->get_field_id( 'length' ); ?>">
222
+ <?php _e( 'Excerpt Length', 'rpwe' ); ?>
223
+ </label>
224
+ <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'] ); ?>" />
225
+ </p>
226
+
227
+ <p>
228
+ <input id="<?php echo $this->get_field_id( 'readmore' ); ?>" name="<?php echo $this->get_field_name( 'readmore' ); ?>" type="checkbox" <?php checked( $instance['readmore'] ); ?> />
229
+ <label class="input-checkbox" for="<?php echo $this->get_field_id( 'readmore' ); ?>">
230
+ <?php _e( 'Display Readmore', 'rpwe' ); ?>
231
+ </label>
232
+ </p>
233
+
234
+ <p>
235
+ <label for="<?php echo $this->get_field_id( 'readmore_text' ); ?>">
236
+ <?php _e( 'Readmore Text', 'rpwe' ); ?>
237
+ </label>
238
+ <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'] ); ?>" />
239
+ </p>
240
+
241
+ <p>
242
+ <input id="<?php echo $this->get_field_id( 'date' ); ?>" name="<?php echo $this->get_field_name( 'date' ); ?>" type="checkbox" <?php checked( $instance['date'] ); ?> />
243
+ <label class="input-checkbox" for="<?php echo $this->get_field_id( 'date' ); ?>">
244
+ <?php _e( 'Display Date', 'rpwe' ); ?>
245
+ </label>
246
+ </p>
247
+ <p>
248
+ <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'] ); ?> />
249
+ <label for="<?php echo $this->get_field_id( 'date_relative' ); ?>">
250
+ <?php _e( 'Use Relative Date. eg: 5 days ago', 'rpwe' ); ?>
251
+ </label>
252
+ </p>
253
+
254
+ </div>
255
+
256
+ <div class="clear"></div>
257
+
258
+ <p>
259
+ <label for="<?php echo $this->get_field_id( 'css' ); ?>">
260
+ <?php _e( 'Custom CSS', 'rpwe' ); ?>
261
+ </label>
262
+ <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>
263
+ <small><?php _e( 'If you turn off the default styles, you can use these css code to customize the recent posts style.', 'rpwe' ); ?></small>
264
  </p>
includes/functions.php CHANGED
@@ -1,279 +1,280 @@
1
- <?php
2
- /**
3
- * Various functions used by the plugin.
4
- *
5
- * @package Recent_Posts_Widget_Extended
6
- * @since 0.9.4
7
- * @author Satrya
8
- * @copyright Copyright (c) 2014, Satrya
9
- * @license http://www.gnu.org/licenses/gpl-2.0.html
10
- */
11
-
12
- /**
13
- * Sets up the default arguments.
14
- *
15
- * @since 0.9.4
16
- */
17
- function rpwe_get_default_args() {
18
-
19
- $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-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";
20
-
21
- $defaults = array(
22
- 'title' => esc_attr__( 'Recent Posts', 'rpwe' ),
23
- 'title_url' => '',
24
-
25
- 'limit' => 5,
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
-
36
- 'excerpt' => false,
37
- 'length' => 10,
38
- 'thumb' => true,
39
- 'thumb_height' => 45,
40
- 'thumb_width' => 45,
41
- 'thumb_default' => 'http://placehold.it/45x45/f0f0f0/ccc',
42
- 'thumb_align' => 'rpwe-alignleft',
43
- 'date' => true,
44
- 'date_relative' => false,
45
- 'readmore' => false,
46
- 'readmore_text' => __( 'Read More &raquo;', 'rpwe' ),
47
-
48
- 'styles_default' => true,
49
- 'css' => $css_defaults,
50
- 'cssID' => '',
51
- 'before' => '',
52
- 'after' => ''
53
- );
54
-
55
- // Allow plugins/themes developer to filter the default arguments.
56
- return apply_filters( 'rpwe_default_args', $defaults );
57
-
58
- }
59
-
60
- /**
61
- * Outputs the recent posts.
62
- *
63
- * @since 0.9.4
64
- */
65
- function rpwe_recent_posts( $args = array() ) {
66
- echo rpwe_get_recent_posts( $args );
67
- }
68
-
69
- /**
70
- * Generates the posts markup.
71
- *
72
- * @since 0.9.4
73
- * @param array $args
74
- * @return string|array The HTML for the random posts.
75
- */
76
- function rpwe_get_recent_posts( $args = array() ) {
77
-
78
- // Set up a default, empty variable.
79
- $html = '';
80
-
81
- // Merge the input arguments and the defaults.
82
- $args = wp_parse_args( $args, rpwe_get_default_args() );
83
-
84
- // Extract the array to allow easy use of variables.
85
- extract( $args );
86
-
87
- // Allow devs to hook in stuff before the loop.
88
- do_action( 'rpwe_before_loop' );
89
-
90
- // Display the default style of the plugin.
91
- if ( $args['styles_default'] == true ) {
92
- rpwe_custom_styles();
93
- }
94
-
95
- // If the default style is disbale then use the custom css if it not empty.
96
- if ( $args['styles_default'] == false && ! empty( $args['css'] ) ) {
97
- echo '<style>' . $args['css'] . '</style>';
98
- }
99
-
100
- // Get the posts query.
101
- $posts = rpwe_get_posts( $args );
102
-
103
- if ( $posts->have_posts() ) :
104
-
105
- $html = '<div ' . ( ! empty( $args['cssID'] ) ? 'id="' . sanitize_html_class( $args['cssID'] ) . '"' : '' ) . ' class="rpwe-block">';
106
-
107
- $html .= '<ul class="rpwe-ul">';
108
-
109
- while ( $posts->have_posts() ) : $posts->the_post();
110
-
111
- // Thumbnails
112
- $thumb_id = get_post_thumbnail_id(); // Get the featured image id.
113
- $img_url = wp_get_attachment_url( $thumb_id ); // Get img URL.
114
-
115
- // Display the image url and crop using the resizer.
116
- $image = rpwe_resize( $img_url, $args['thumb_width'], $args['thumb_height'], true );
117
-
118
- // Start recent posts markup.
119
- $html .= '<li class="rpwe-li rpwe-clearfix">';
120
-
121
- if ( $args['thumb'] ) :
122
-
123
- // Check if post has post thumbnail.
124
- if ( has_post_thumbnail() ) :
125
- $html .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
126
- if ( $image ) :
127
- $html .= '<img class="' . esc_attr( $args['thumb_align'] ) . ' rpwe-thumb" src="' . esc_url( $image ) . '" alt="' . esc_attr( get_the_title() ) . '">';
128
- else :
129
- $html .= '<img class="' . esc_attr( $args['thumb_align'] ) . ' rpwe-thumb" src="' . esc_url( $img_url ) . '" alt="' . esc_attr( get_the_title() ) . '" height="' . $args['thumb_height'] . '" width="' . $args['thumb_width'] . '">';
130
- endif;
131
- $html .= '</a>';
132
-
133
- // If no post thumbnail found, check if Get The Image plugin exist and display the image.
134
- elseif ( function_exists( 'get_the_image' ) ) :
135
- $html .= get_the_image( array(
136
- 'height' => (int) $args['thumb_height'],
137
- 'width' => (int) $args['thumb_width'],
138
- 'image_class' => esc_attr( $args['thumb_align'] ) . ' rpwe-thumb get-the-image',
139
- 'image_scan' => true,
140
- 'default_image' => esc_url( $args['thumb_default'] )
141
- ) );
142
-
143
- // Display default image.
144
- elseif ( ! empty( $args['thumb_default'] ) ) :
145
- $html .= sprintf( '<a 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>',
146
- esc_url( get_permalink() ),
147
- esc_attr( $args['thumb_align'] ),
148
- esc_url( $args['thumb_default'] ),
149
- esc_attr( get_the_title() ),
150
- (int) $args['thumb_width'],
151
- (int) $args['thumb_height']
152
- );
153
-
154
- endif;
155
-
156
- endif;
157
-
158
- $html .= '<h3 class="rpwe-title"><a href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'rpwe' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark">' . esc_attr( get_the_title() ) . '</a></h3>';
159
-
160
- if ( $args['date'] ) :
161
- $date = get_the_date();
162
- if ( $args['date_relative'] ) :
163
- $date = sprintf( __( '%s ago', 'rpwe' ), human_time_diff( get_the_date( 'U' ), current_time( 'timestamp' ) ) );
164
- endif;
165
- $html .= '<time class="rpwe-time published" datetime="' . esc_html( get_the_date( 'c' ) ) . '">' . esc_html( $date ) . '</time>';
166
- endif;
167
-
168
- if ( $args['excerpt'] ) :
169
- $html .= '<div class="rpwe-summary">';
170
- $html .= wp_trim_words( apply_filters( 'rpwe_excerpt', get_the_excerpt() ), $args['length'], ' &hellip;' );
171
- if ( $args['readmore'] ) :
172
- $html .= '<a href="' . esc_url( get_permalink() ) . '" class="more-link">' . $args['readmore_text'] . '</a>';
173
- endif;
174
- $html .= '</div>';
175
- endif;
176
-
177
- $html .= '</li>';
178
-
179
- endwhile;
180
-
181
- $html .= '</ul>';
182
-
183
- $html .= '</div><!-- Generated by http://wordpress.org/plugins/recent-posts-widget-extended/ -->';
184
-
185
- endif;
186
-
187
- // Restore original Post Data.
188
- wp_reset_postdata();
189
-
190
- // Allow devs to hook in stuff after the loop.
191
- do_action( 'rpwe_after_loop' );
192
-
193
- // Return the posts markup.
194
- return $args['before'] . apply_filters( 'rpwe_markup', $html ) . $args['after'];
195
-
196
- }
197
-
198
- /**
199
- * The posts query.
200
- *
201
- * @since 0.0.1
202
- * @param array $args
203
- * @return array
204
- */
205
- function rpwe_get_posts( $args = array() ) {
206
-
207
- // Query arguments.
208
- $query = array(
209
- 'offset' => $args['offset'],
210
- 'posts_per_page' => $args['limit'],
211
- 'orderby' => $args['orderby'],
212
- 'order' => $args['order'],
213
- 'post_type' => $args['post_type'],
214
- 'post_status' => $args['post_status'],
215
- 'ignore_sticky_posts' => $args['ignore_sticky'],
216
- );
217
-
218
- // Limit posts based on category.
219
- if ( ! empty( $args['cat'] ) ) {
220
- $query['category__in'] = $args['cat'];
221
- }
222
-
223
- // Limit posts based on post tag.
224
- if ( ! empty( $args['tag'] ) ) {
225
- $query['tag__in'] = $args['tag'];
226
- }
227
-
228
- /**
229
- * Taxonomy query.
230
- * Prop Miniloop plugin by Kailey Lampert.
231
- */
232
- if ( ! empty( $args['taxonomy'] ) ) {
233
-
234
- parse_str( $args['taxonomy'], $taxes );
235
-
236
- $operator = 'IN';
237
- $tax_query = array();
238
- foreach( array_keys( $taxes ) as $k => $slug ) {
239
- $ids = explode( ',', $taxes[$slug] );
240
- if ( count( $ids ) == 1 && $ids['0'] < 0 ) {
241
- // If there is only one id given, and it's negative
242
- // Let's treat it as 'posts not in'
243
- $ids['0'] = $ids['0'] * -1;
244
- $operator = 'NOT IN';
245
- }
246
- $tax_query[] = array(
247
- 'taxonomy' => $slug,
248
- 'field' => 'id',
249
- 'terms' => $ids,
250
- 'operator' => $operator
251
- );
252
- }
253
-
254
- $query['tax_query'] = $tax_query;
255
-
256
- }
257
-
258
- // Allow plugins/themes developer to filter the default query.
259
- $query = apply_filters( 'rpwe_default_query_arguments', $query );
260
-
261
- // Perform the query.
262
- $posts = new WP_Query( $query );
263
-
264
- return $posts;
265
-
266
- }
267
-
268
- /**
269
- * Custom Styles.
270
- *
271
- * @since 0.8
272
- */
273
- function rpwe_custom_styles() {
274
- ?>
275
- <style>
276
- .rpwe-block ul{list-style:none!important;margin-left:0!important;padding-left:0!important;}.rpwe-block li{border-bottom:1px solid #eee;margin-bottom:10px;padding-bottom:10px;list-style-type: none;}.rpwe-block a{display:inline!important;text-decoration:none;}.rpwe-block h3{background:none!important;clear:none;margin-bottom:0!important;margin-top:0!important;font-weight:400;font-size:12px!important;line-height:1.5em;}.rpwe-thumb{border:1px solid #EEE!important;box-shadow:none!important;margin:2px 10px 2px 0;padding:3px!important;}.rpwe-summary{font-size:12px;}.rpwe-time{color:#bbb;font-size:11px;}.rpwe-alignleft{display:inline;float:left;}.rpwe-alignright{display:inline;float:right;}.rpwe-aligncenter{display:block;margin-left: auto;margin-right: auto;}.rpwe-clearfix:before,.rpwe-clearfix:after{content:"";display:table !important;}.rpwe-clearfix:after{clear:both;}.rpwe-clearfix{zoom:1;}
277
- </style>
278
- <?php
 
279
  }
1
+ <?php
2
+ /**
3
+ * Various functions used by the plugin.
4
+ *
5
+ * @package Recent_Posts_Widget_Extended
6
+ * @since 0.9.4
7
+ * @author Satrya
8
+ * @copyright Copyright (c) 2014, Satrya
9
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
10
+ */
11
+
12
+ /**
13
+ * Sets up the default arguments.
14
+ *
15
+ * @since 0.9.4
16
+ */
17
+ function rpwe_get_default_args() {
18
+
19
+ $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-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";
20
+
21
+ $defaults = array(
22
+ 'title' => esc_attr__( 'Recent Posts', 'rpwe' ),
23
+ 'title_url' => '',
24
+
25
+ 'limit' => 5,
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
+
36
+ 'excerpt' => false,
37
+ 'length' => 10,
38
+ 'thumb' => true,
39
+ 'thumb_height' => 45,
40
+ 'thumb_width' => 45,
41
+ 'thumb_default' => 'http://placehold.it/45x45/f0f0f0/ccc',
42
+ 'thumb_align' => 'rpwe-alignleft',
43
+ 'date' => true,
44
+ 'date_relative' => false,
45
+ 'readmore' => false,
46
+ 'readmore_text' => __( 'Read More &raquo;', 'rpwe' ),
47
+
48
+ 'styles_default' => true,
49
+ 'css' => $css_defaults,
50
+ 'cssID' => '',
51
+ 'before' => '',
52
+ 'after' => ''
53
+ );
54
+
55
+ // Allow plugins/themes developer to filter the default arguments.
56
+ return apply_filters( 'rpwe_default_args', $defaults );
57
+
58
+ }
59
+
60
+ /**
61
+ * Outputs the recent posts.
62
+ *
63
+ * @since 0.9.4
64
+ */
65
+ function rpwe_recent_posts( $args = array() ) {
66
+ echo rpwe_get_recent_posts( $args );
67
+ }
68
+
69
+ /**
70
+ * Generates the posts markup.
71
+ *
72
+ * @since 0.9.4
73
+ * @param array $args
74
+ * @return string|array The HTML for the random posts.
75
+ */
76
+ function rpwe_get_recent_posts( $args = array() ) {
77
+
78
+ // Set up a default, empty variable.
79
+ $html = '';
80
+
81
+ // Merge the input arguments and the defaults.
82
+ $args = wp_parse_args( $args, rpwe_get_default_args() );
83
+
84
+ // Extract the array to allow easy use of variables.
85
+ extract( $args );
86
+
87
+ // Allow devs to hook in stuff before the loop.
88
+ do_action( 'rpwe_before_loop' );
89
+
90
+ // Display the default style of the plugin.
91
+ if ( $args['styles_default'] == true ) {
92
+ rpwe_custom_styles();
93
+ }
94
+
95
+ // If the default style is disbale then use the custom css if it not empty.
96
+ if ( $args['styles_default'] == false && ! empty( $args['css'] ) ) {
97
+ echo '<style>' . $args['css'] . '</style>';
98
+ }
99
+
100
+ // Get the posts query.
101
+ $posts = rpwe_get_posts( $args );
102
+
103
+ if ( $posts->have_posts() ) :
104
+
105
+ $html = '<div ' . ( ! empty( $args['cssID'] ) ? 'id="' . sanitize_html_class( $args['cssID'] ) . '"' : '' ) . ' class="rpwe-block">';
106
+
107
+ $html .= '<ul class="rpwe-ul">';
108
+
109
+ while ( $posts->have_posts() ) : $posts->the_post();
110
+
111
+ // Thumbnails
112
+ $thumb_id = get_post_thumbnail_id(); // Get the featured image id.
113
+ $img_url = wp_get_attachment_url( $thumb_id ); // Get img URL.
114
+
115
+ // Display the image url and crop using the resizer.
116
+ $image = rpwe_resize( $img_url, $args['thumb_width'], $args['thumb_height'], true );
117
+
118
+ // Start recent posts markup.
119
+ $html .= '<li class="rpwe-li rpwe-clearfix">';
120
+
121
+ if ( $args['thumb'] ) :
122
+
123
+ // Check if post has post thumbnail.
124
+ if ( has_post_thumbnail() ) :
125
+ $html .= '<a href="' . esc_url( get_permalink() ) . '" rel="bookmark">';
126
+ if ( $image ) :
127
+ $html .= '<img class="' . esc_attr( $args['thumb_align'] ) . ' rpwe-thumb" src="' . esc_url( $image ) . '" alt="' . esc_attr( get_the_title() ) . '">';
128
+ else :
129
+ $html .= '<img class="' . esc_attr( $args['thumb_align'] ) . ' rpwe-thumb" src="' . esc_url( $img_url ) . '" alt="' . esc_attr( get_the_title() ) . '" height="' . $args['thumb_height'] . '" width="' . $args['thumb_width'] . '">';
130
+ endif;
131
+ $html .= '</a>';
132
+
133
+ // If no post thumbnail found, check if Get The Image plugin exist and display the image.
134
+ elseif ( function_exists( 'get_the_image' ) ) :
135
+ $html .= get_the_image( array(
136
+ 'height' => (int) $args['thumb_height'],
137
+ 'width' => (int) $args['thumb_width'],
138
+ 'image_class' => esc_attr( $args['thumb_align'] ) . ' rpwe-thumb get-the-image',
139
+ 'image_scan' => true,
140
+ 'echo' => false,
141
+ 'default_image' => esc_url( $args['thumb_default'] )
142
+ ) );
143
+
144
+ // Display default image.
145
+ elseif ( ! empty( $args['thumb_default'] ) ) :
146
+ $html .= sprintf( '<a 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>',
147
+ esc_url( get_permalink() ),
148
+ esc_attr( $args['thumb_align'] ),
149
+ esc_url( $args['thumb_default'] ),
150
+ esc_attr( get_the_title() ),
151
+ (int) $args['thumb_width'],
152
+ (int) $args['thumb_height']
153
+ );
154
+
155
+ endif;
156
+
157
+ endif;
158
+
159
+ $html .= '<h3 class="rpwe-title"><a href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'rpwe' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark">' . esc_attr( get_the_title() ) . '</a></h3>';
160
+
161
+ if ( $args['date'] ) :
162
+ $date = get_the_date();
163
+ if ( $args['date_relative'] ) :
164
+ $date = sprintf( __( '%s ago', 'rpwe' ), human_time_diff( get_the_date( 'U' ), current_time( 'timestamp' ) ) );
165
+ endif;
166
+ $html .= '<time class="rpwe-time published" datetime="' . esc_html( get_the_date( 'c' ) ) . '">' . esc_html( $date ) . '</time>';
167
+ endif;
168
+
169
+ if ( $args['excerpt'] ) :
170
+ $html .= '<div class="rpwe-summary">';
171
+ $html .= wp_trim_words( apply_filters( 'rpwe_excerpt', get_the_excerpt() ), $args['length'], ' &hellip;' );
172
+ if ( $args['readmore'] ) :
173
+ $html .= '<a href="' . esc_url( get_permalink() ) . '" class="more-link">' . $args['readmore_text'] . '</a>';
174
+ endif;
175
+ $html .= '</div>';
176
+ endif;
177
+
178
+ $html .= '</li>';
179
+
180
+ endwhile;
181
+
182
+ $html .= '</ul>';
183
+
184
+ $html .= '</div><!-- Generated by http://wordpress.org/plugins/recent-posts-widget-extended/ -->';
185
+
186
+ endif;
187
+
188
+ // Restore original Post Data.
189
+ wp_reset_postdata();
190
+
191
+ // Allow devs to hook in stuff after the loop.
192
+ do_action( 'rpwe_after_loop' );
193
+
194
+ // Return the posts markup.
195
+ return $args['before'] . apply_filters( 'rpwe_markup', $html ) . $args['after'];
196
+
197
+ }
198
+
199
+ /**
200
+ * The posts query.
201
+ *
202
+ * @since 0.0.1
203
+ * @param array $args
204
+ * @return array
205
+ */
206
+ function rpwe_get_posts( $args = array() ) {
207
+
208
+ // Query arguments.
209
+ $query = array(
210
+ 'offset' => $args['offset'],
211
+ 'posts_per_page' => $args['limit'],
212
+ 'orderby' => $args['orderby'],
213
+ 'order' => $args['order'],
214
+ 'post_type' => $args['post_type'],
215
+ 'post_status' => $args['post_status'],
216
+ 'ignore_sticky_posts' => $args['ignore_sticky'],
217
+ );
218
+
219
+ // Limit posts based on category.
220
+ if ( ! empty( $args['cat'] ) ) {
221
+ $query['category__in'] = $args['cat'];
222
+ }
223
+
224
+ // Limit posts based on post tag.
225
+ if ( ! empty( $args['tag'] ) ) {
226
+ $query['tag__in'] = $args['tag'];
227
+ }
228
+
229
+ /**
230
+ * Taxonomy query.
231
+ * Prop Miniloop plugin by Kailey Lampert.
232
+ */
233
+ if ( ! empty( $args['taxonomy'] ) ) {
234
+
235
+ parse_str( $args['taxonomy'], $taxes );
236
+
237
+ $operator = 'IN';
238
+ $tax_query = array();
239
+ foreach( array_keys( $taxes ) as $k => $slug ) {
240
+ $ids = explode( ',', $taxes[$slug] );
241
+ if ( count( $ids ) == 1 && $ids['0'] < 0 ) {
242
+ // If there is only one id given, and it's negative
243
+ // Let's treat it as 'posts not in'
244
+ $ids['0'] = $ids['0'] * -1;
245
+ $operator = 'NOT IN';
246
+ }
247
+ $tax_query[] = array(
248
+ 'taxonomy' => $slug,
249
+ 'field' => 'id',
250
+ 'terms' => $ids,
251
+ 'operator' => $operator
252
+ );
253
+ }
254
+
255
+ $query['tax_query'] = $tax_query;
256
+
257
+ }
258
+
259
+ // Allow plugins/themes developer to filter the default query.
260
+ $query = apply_filters( 'rpwe_default_query_arguments', $query );
261
+
262
+ // Perform the query.
263
+ $posts = new WP_Query( $query );
264
+
265
+ return $posts;
266
+
267
+ }
268
+
269
+ /**
270
+ * Custom Styles.
271
+ *
272
+ * @since 0.8
273
+ */
274
+ function rpwe_custom_styles() {
275
+ ?>
276
+ <style>
277
+ .rpwe-block ul{list-style:none!important;margin-left:0!important;padding-left:0!important;}.rpwe-block li{border-bottom:1px solid #eee;margin-bottom:10px;padding-bottom:10px;list-style-type: none;}.rpwe-block a{display:inline!important;text-decoration:none;}.rpwe-block h3{background:none!important;clear:none;margin-bottom:0!important;margin-top:0!important;font-weight:400;font-size:12px!important;line-height:1.5em;}.rpwe-thumb{border:1px solid #EEE!important;box-shadow:none!important;margin:2px 10px 2px 0;padding:3px!important;}.rpwe-summary{font-size:12px;}.rpwe-time{color:#bbb;font-size:11px;}.rpwe-alignleft{display:inline;float:left;}.rpwe-alignright{display:inline;float:right;}.rpwe-aligncenter{display:block;margin-left: auto;margin-right: auto;}.rpwe-clearfix:before,.rpwe-clearfix:after{content:"";display:table !important;}.rpwe-clearfix:after{clear:both;}.rpwe-clearfix{zoom:1;}
278
+ </style>
279
+ <?php
280
  }
includes/resizer.php CHANGED
@@ -1,209 +1,209 @@
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
- /**
31
- * The singleton instance
32
- */
33
- static private $instance = null;
34
-
35
- /**
36
- * No initialization allowed
37
- */
38
- private function __construct() {}
39
-
40
- /**
41
- * No cloning allowed
42
- */
43
- private function __clone() {}
44
-
45
- /**
46
- * For your custom default usage you may want to initialize an Rpwe_Resize object by yourself and then have own defaults
47
- */
48
- static public function getInstance() {
49
- if(self::$instance == null) {
50
- self::$instance = new self;
51
- }
52
-
53
- return self::$instance;
54
- }
55
-
56
- /**
57
- * Run, forest.
58
- */
59
- public function process( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) {
60
- // Validate inputs.
61
- if ( ! $url || ( ! $width && ! $height ) ) return false;
62
-
63
- // Caipt'n, ready to hook.
64
- if ( true === $upscale ) add_filter( 'image_resize_dimensions', array($this, 'rpwe_upscale'), 10, 6 );
65
-
66
- // Define upload path & dir.
67
- $upload_info = wp_upload_dir();
68
- $upload_dir = $upload_info['basedir'];
69
- $upload_url = $upload_info['baseurl'];
70
-
71
- $http_prefix = "http://";
72
- $https_prefix = "https://";
73
-
74
- /* if the $url scheme differs from $upload_url scheme, make them match
75
- if the schemes differe, images don't show up. */
76
- if(!strncmp($url,$https_prefix,strlen($https_prefix))){ //if url begins with https:// make $upload_url begin with https:// as well
77
- $upload_url = str_replace($http_prefix,$https_prefix,$upload_url);
78
- }
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
-
143
- // Okay, leave the ship.
144
- if ( true === $upscale ) remove_filter( 'image_resize_dimensions', array( $this, 'rpwe_upscale' ) );
145
-
146
- // Return the output.
147
- if ( $single ) {
148
- // str return.
149
- $image = $img_url;
150
- } else {
151
- // array return.
152
- $image = array (
153
- 0 => $img_url,
154
- 1 => $dst_w,
155
- 2 => $dst_h
156
- );
157
- }
158
-
159
- return $image;
160
- }
161
-
162
- /**
163
- * Callback to overwrite WP computing of thumbnail measures
164
- */
165
- function rpwe_upscale( $default, $orig_w, $orig_h, $dest_w, $dest_h, $crop ) {
166
- if ( ! $crop ) return null; // Let the wordpress default function handle this.
167
-
168
- // Here is the point we allow to use larger image size than the original one.
169
- $aspect_ratio = $orig_w / $orig_h;
170
- $new_w = $dest_w;
171
- $new_h = $dest_h;
172
-
173
- if ( ! $new_w ) {
174
- $new_w = intval( $new_h * $aspect_ratio );
175
- }
176
-
177
- if ( ! $new_h ) {
178
- $new_h = intval( $new_w / $aspect_ratio );
179
- }
180
-
181
- $size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );
182
-
183
- $crop_w = round( $new_w / $size_ratio );
184
- $crop_h = round( $new_h / $size_ratio );
185
-
186
- $s_x = floor( ( $orig_w - $crop_w ) / 2 );
187
- $s_y = floor( ( $orig_h - $crop_h ) / 2 );
188
-
189
- return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
190
- }
191
- }
192
- }
193
-
194
-
195
-
196
-
197
-
198
- if(!function_exists('rpwe_resize')) {
199
-
200
- /**
201
- * This is just a tiny wrapper function for the class above so that there is no
202
- * need to change any code in your own WP themes. Usage is still the same :)
203
- */
204
- function rpwe_resize( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) {
205
- $rpwe_resize = Rpwe_Resize::getInstance();
206
- return $rpwe_resize->process( $url, $width, $height, $crop, $single, $upscale );
207
- }
208
- }
209
-
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
+ /**
31
+ * The singleton instance
32
+ */
33
+ static private $instance = null;
34
+
35
+ /**
36
+ * No initialization allowed
37
+ */
38
+ private function __construct() {}
39
+
40
+ /**
41
+ * No cloning allowed
42
+ */
43
+ private function __clone() {}
44
+
45
+ /**
46
+ * For your custom default usage you may want to initialize an Rpwe_Resize object by yourself and then have own defaults
47
+ */
48
+ static public function getInstance() {
49
+ if(self::$instance == null) {
50
+ self::$instance = new self;
51
+ }
52
+
53
+ return self::$instance;
54
+ }
55
+
56
+ /**
57
+ * Run, forest.
58
+ */
59
+ public function process( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) {
60
+ // Validate inputs.
61
+ if ( ! $url || ( ! $width && ! $height ) ) return false;
62
+
63
+ // Caipt'n, ready to hook.
64
+ if ( true === $upscale ) add_filter( 'image_resize_dimensions', array($this, 'rpwe_upscale'), 10, 6 );
65
+
66
+ // Define upload path & dir.
67
+ $upload_info = wp_upload_dir();
68
+ $upload_dir = $upload_info['basedir'];
69
+ $upload_url = $upload_info['baseurl'];
70
+
71
+ $http_prefix = "http://";
72
+ $https_prefix = "https://";
73
+
74
+ /* if the $url scheme differs from $upload_url scheme, make them match
75
+ if the schemes differe, images don't show up. */
76
+ if(!strncmp($url,$https_prefix,strlen($https_prefix))){ //if url begins with https:// make $upload_url begin with https:// as well
77
+ $upload_url = str_replace($http_prefix,$https_prefix,$upload_url);
78
+ }
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
+
143
+ // Okay, leave the ship.
144
+ if ( true === $upscale ) remove_filter( 'image_resize_dimensions', array( $this, 'rpwe_upscale' ) );
145
+
146
+ // Return the output.
147
+ if ( $single ) {
148
+ // str return.
149
+ $image = $img_url;
150
+ } else {
151
+ // array return.
152
+ $image = array (
153
+ 0 => $img_url,
154
+ 1 => $dst_w,
155
+ 2 => $dst_h
156
+ );
157
+ }
158
+
159
+ return $image;
160
+ }
161
+
162
+ /**
163
+ * Callback to overwrite WP computing of thumbnail measures
164
+ */
165
+ function rpwe_upscale( $default, $orig_w, $orig_h, $dest_w, $dest_h, $crop ) {
166
+ if ( ! $crop ) return null; // Let the wordpress default function handle this.
167
+
168
+ // Here is the point we allow to use larger image size than the original one.
169
+ $aspect_ratio = $orig_w / $orig_h;
170
+ $new_w = $dest_w;
171
+ $new_h = $dest_h;
172
+
173
+ if ( ! $new_w ) {
174
+ $new_w = intval( $new_h * $aspect_ratio );
175
+ }
176
+
177
+ if ( ! $new_h ) {
178
+ $new_h = intval( $new_w / $aspect_ratio );
179
+ }
180
+
181
+ $size_ratio = max( $new_w / $orig_w, $new_h / $orig_h );
182
+
183
+ $crop_w = round( $new_w / $size_ratio );
184
+ $crop_h = round( $new_h / $size_ratio );
185
+
186
+ $s_x = floor( ( $orig_w - $crop_w ) / 2 );
187
+ $s_y = floor( ( $orig_h - $crop_h ) / 2 );
188
+
189
+ return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
190
+ }
191
+ }
192
+ }
193
+
194
+
195
+
196
+
197
+
198
+ if(!function_exists('rpwe_resize')) {
199
+
200
+ /**
201
+ * This is just a tiny wrapper function for the class above so that there is no
202
+ * need to change any code in your own WP themes. Usage is still the same :)
203
+ */
204
+ function rpwe_resize( $url, $width = null, $height = null, $crop = null, $single = true, $upscale = false ) {
205
+ $rpwe_resize = Rpwe_Resize::getInstance();
206
+ return $rpwe_resize->process( $url, $width, $height, $crop, $single, $upscale );
207
+ }
208
+ }
209
+
includes/shortcode.php CHANGED
@@ -1,21 +1,21 @@
1
- <?php
2
- /**
3
- * Shortcode helper
4
- *
5
- * @package Recent_Posts_Widget_Extended
6
- * @since 0.9.4
7
- * @author Satrya
8
- * @copyright Copyright (c) 2014, Satrya
9
- * @license http://www.gnu.org/licenses/gpl-2.0.html
10
- */
11
-
12
- /**
13
- * Display recent posts with shortcode.
14
- *
15
- * @since 0.9.4
16
- */
17
- function rpwe_shortcode( $atts, $content ) {
18
- $args = shortcode_atts( rpwe_get_default_args(), $atts );
19
- return rpwe_get_recent_posts( $args );
20
- }
21
  add_shortcode( 'rpwe', 'rpwe_shortcode' );
1
+ <?php
2
+ /**
3
+ * Shortcode helper
4
+ *
5
+ * @package Recent_Posts_Widget_Extended
6
+ * @since 0.9.4
7
+ * @author Satrya
8
+ * @copyright Copyright (c) 2014, Satrya
9
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
10
+ */
11
+
12
+ /**
13
+ * Display recent posts with shortcode.
14
+ *
15
+ * @since 0.9.4
16
+ */
17
+ function rpwe_shortcode( $atts, $content ) {
18
+ $args = shortcode_atts( rpwe_get_default_args(), $atts );
19
+ return rpwe_get_recent_posts( $args );
20
+ }
21
  add_shortcode( 'rpwe', 'rpwe_shortcode' );
languages/rpwe-fr_FR.po CHANGED
@@ -1,195 +1,195 @@
1
- msgid ""
2
- msgstr ""
3
- "Project-Id-Version: Recent Posts Widget Extended\n"
4
- "POT-Creation-Date: 2014-04-11 12:32-0500\n"
5
- "PO-Revision-Date: 2014-04-11 12:40-0500\n"
6
- "Last-Translator: Matthieu Durocher <matthieu@technocyclope.com>\n"
7
- "Language-Team: Matthieu Durocher <matthieu@technocyclope.com>\n"
8
- "Language: fr_FR\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.4\n"
13
- "X-Poedit-Basepath: ..\n"
14
- "X-Poedit-SourceCharset: UTF-8\n"
15
- "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
16
- "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
17
- "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
18
- "Plural-Forms: nplurals=2; plural=(n > 1);\n"
19
- "X-Poedit-SearchPath-0: .\n"
20
-
21
- #: includes/widget-recent-posts-extended.php:19
22
- msgid ""
23
- "An advanced widget that gives you total control over the output of your "
24
- "site’s most recent Posts."
25
- msgstr ""
26
- "Un widget de pointe qui vous donne un contrôle total sur l'affichage des "
27
- "derniers billets de votre site."
28
-
29
- #: includes/widget-recent-posts-extended.php:28
30
- msgid "Recent Posts Extended"
31
- msgstr "Recent Posts Extended"
32
-
33
- #: includes/widget-recent-posts-extended.php:119
34
- #: includes/widget-recent-posts-extended.php:159
35
- #, php-format
36
- msgid "Permalink to %s"
37
- msgstr "Lien vers %s"
38
-
39
- #: includes/widget-recent-posts-extended.php:251
40
- msgid "Read More &raquo;"
41
- msgstr "Lire la suite..."
42
-
43
- #: includes/widget-recent-posts-extended.php:286
44
- msgid "Title:"
45
- msgstr "Titre :"
46
-
47
- #: includes/widget-recent-posts-extended.php:290
48
- msgid "Title URL:"
49
- msgstr "Lien du titre :"
50
-
51
- #: includes/widget-recent-posts-extended.php:294
52
- msgid "CSS ID:"
53
- msgstr "CSS ID :"
54
-
55
- #: includes/widget-recent-posts-extended.php:298
56
- msgid "Use Default Styles"
57
- msgstr "Utilisez les styles par défaut"
58
-
59
- #: includes/widget-recent-posts-extended.php:302
60
- msgid "CSS:"
61
- msgstr "CSS :"
62
-
63
- #: includes/widget-recent-posts-extended.php:304
64
- msgid "If you turn off the default styles, please create your own style."
65
- msgstr ""
66
- "Si vous désactivez les styles par défaut, s'il vous plaît créer votre propre "
67
- "style."
68
-
69
- #: includes/widget-recent-posts-extended.php:312
70
- msgid "Limit:"
71
- msgstr "Limite :"
72
-
73
- #: includes/widget-recent-posts-extended.php:316
74
- msgid "Offset (the number of posts to skip):"
75
- msgstr "Décalage (le nombre de postes à sauter) :"
76
-
77
- #: includes/widget-recent-posts-extended.php:320
78
- msgid "Order:"
79
- msgstr "Ordre :"
80
-
81
- #: includes/widget-recent-posts-extended.php:322
82
- msgid "DESC"
83
- msgstr "DESC"
84
-
85
- #: includes/widget-recent-posts-extended.php:323
86
- msgid "ASC"
87
- msgstr "ASC"
88
-
89
- #: includes/widget-recent-posts-extended.php:327
90
- msgid "Orderby:"
91
- msgstr "Ordre par :"
92
-
93
- #: includes/widget-recent-posts-extended.php:329
94
- msgid "ID"
95
- msgstr "ID"
96
-
97
- #: includes/widget-recent-posts-extended.php:330
98
- msgid "Author"
99
- msgstr "Auteur"
100
-
101
- #: includes/widget-recent-posts-extended.php:331
102
- msgid "Title"
103
- msgstr "Titre"
104
-
105
- #: includes/widget-recent-posts-extended.php:332
106
- msgid "Date"
107
- msgstr "Date"
108
-
109
- #: includes/widget-recent-posts-extended.php:333
110
- msgid "Modified"
111
- msgstr "Modifié"
112
-
113
- #: includes/widget-recent-posts-extended.php:334
114
- msgid "Random"
115
- msgstr "Au hasard"
116
-
117
- #: includes/widget-recent-posts-extended.php:335
118
- msgid "Comment Count"
119
- msgstr "Décompte des commentaires"
120
-
121
- #: includes/widget-recent-posts-extended.php:336
122
- msgid "Menu Order"
123
- msgstr "Ordre du menu"
124
-
125
- #: includes/widget-recent-posts-extended.php:340
126
- msgid "Limit to Category: "
127
- msgstr "Limiter à une catégorie :"
128
-
129
- #: includes/widget-recent-posts-extended.php:351
130
- msgid "Limit to Tag: "
131
- msgstr "Limiter à un mot clé :"
132
-
133
- #: includes/widget-recent-posts-extended.php:363
134
- msgid "Choose the Post Type: "
135
- msgstr "Choisir le type d'article :"
136
-
137
- #: includes/widget-recent-posts-extended.php:379
138
- msgid "Display Thumbnail"
139
- msgstr "Affichage de la miniature"
140
-
141
- #: includes/widget-recent-posts-extended.php:383
142
- msgid "Thumbnail (height, width, align):"
143
- msgstr "miniature (hauteur, largeur, alignement) :"
144
-
145
- #: includes/widget-recent-posts-extended.php:387
146
- msgid "Left"
147
- msgstr "Gauche"
148
-
149
- #: includes/widget-recent-posts-extended.php:388
150
- msgid "Right"
151
- msgstr "Droite"
152
-
153
- #: includes/widget-recent-posts-extended.php:389
154
- msgid "Center"
155
- msgstr "Centre"
156
-
157
- #: includes/widget-recent-posts-extended.php:393
158
- msgid "Default Thumbnail:"
159
- msgstr "Miniature par défaut :"
160
-
161
- #: includes/widget-recent-posts-extended.php:395
162
- msgid "Leave it blank to disable."
163
- msgstr "Laissez ce champ vide pour désactiver."
164
-
165
- #: includes/widget-recent-posts-extended.php:401
166
- msgid "Display Excerpt"
167
- msgstr "Affichage de l'extrait"
168
-
169
- #: includes/widget-recent-posts-extended.php:405
170
- msgid "Excerpt Length:"
171
- msgstr "Longueur de l'extrait"
172
-
173
- #: includes/widget-recent-posts-extended.php:409
174
- msgid "Display Readmore"
175
- msgstr "Affichage de «Lire la suite»"
176
-
177
- #: includes/widget-recent-posts-extended.php:413
178
- msgid "Readmore Text:"
179
- msgstr "Texte «Lire la suite» :"
180
-
181
- #: includes/widget-recent-posts-extended.php:417
182
- msgid "Display Date"
183
- msgstr "Affichage de la date"
184
-
185
- #: includes/widget-recent-posts-extended.php:421
186
- msgid "Date Format:"
187
- msgstr "Format de date :"
188
-
189
- #: includes/widget-recent-posts-extended.php:423
190
- msgid ""
191
- "<a href=\"http://codex.wordpress.org/Formatting_Date_and_Time\" target="
192
- "\"_blank\">Date reference</a>"
193
- msgstr ""
194
- "<a href=\"http://codex.wordpress.org/Formatting_Date_and_Time\" target="
195
- "\"_blank\">Référence pour les formats de date</a>"
1
+ msgid ""
2
+ msgstr ""
3
+ "Project-Id-Version: Recent Posts Widget Extended\n"
4
+ "POT-Creation-Date: 2014-04-11 12:32-0500\n"
5
+ "PO-Revision-Date: 2014-04-11 12:40-0500\n"
6
+ "Last-Translator: Matthieu Durocher <matthieu@technocyclope.com>\n"
7
+ "Language-Team: Matthieu Durocher <matthieu@technocyclope.com>\n"
8
+ "Language: fr_FR\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.4\n"
13
+ "X-Poedit-Basepath: ..\n"
14
+ "X-Poedit-SourceCharset: UTF-8\n"
15
+ "X-Poedit-KeywordsList: __;_e;_n:1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;esc_attr__;"
16
+ "esc_attr_e;esc_attr_x:1,2c;esc_html__;esc_html_e;esc_html_x:1,2c;_n_noop:1,2;"
17
+ "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
18
+ "Plural-Forms: nplurals=2; plural=(n > 1);\n"
19
+ "X-Poedit-SearchPath-0: .\n"
20
+
21
+ #: includes/widget-recent-posts-extended.php:19
22
+ msgid ""
23
+ "An advanced widget that gives you total control over the output of your "
24
+ "site’s most recent Posts."
25
+ msgstr ""
26
+ "Un widget de pointe qui vous donne un contrôle total sur l'affichage des "
27
+ "derniers billets de votre site."
28
+
29
+ #: includes/widget-recent-posts-extended.php:28
30
+ msgid "Recent Posts Extended"
31
+ msgstr "Recent Posts Extended"
32
+
33
+ #: includes/widget-recent-posts-extended.php:119
34
+ #: includes/widget-recent-posts-extended.php:159
35
+ #, php-format
36
+ msgid "Permalink to %s"
37
+ msgstr "Lien vers %s"
38
+
39
+ #: includes/widget-recent-posts-extended.php:251
40
+ msgid "Read More &raquo;"
41
+ msgstr "Lire la suite..."
42
+
43
+ #: includes/widget-recent-posts-extended.php:286
44
+ msgid "Title:"
45
+ msgstr "Titre :"
46
+
47
+ #: includes/widget-recent-posts-extended.php:290
48
+ msgid "Title URL:"
49
+ msgstr "Lien du titre :"
50
+
51
+ #: includes/widget-recent-posts-extended.php:294
52
+ msgid "CSS ID:"
53
+ msgstr "CSS ID :"
54
+
55
+ #: includes/widget-recent-posts-extended.php:298
56
+ msgid "Use Default Styles"
57
+ msgstr "Utilisez les styles par défaut"
58
+
59
+ #: includes/widget-recent-posts-extended.php:302
60
+ msgid "CSS:"
61
+ msgstr "CSS :"
62
+
63
+ #: includes/widget-recent-posts-extended.php:304
64
+ msgid "If you turn off the default styles, please create your own style."
65
+ msgstr ""
66
+ "Si vous désactivez les styles par défaut, s'il vous plaît créer votre propre "
67
+ "style."
68
+
69
+ #: includes/widget-recent-posts-extended.php:312
70
+ msgid "Limit:"
71
+ msgstr "Limite :"
72
+
73
+ #: includes/widget-recent-posts-extended.php:316
74
+ msgid "Offset (the number of posts to skip):"
75
+ msgstr "Décalage (le nombre de postes à sauter) :"
76
+
77
+ #: includes/widget-recent-posts-extended.php:320
78
+ msgid "Order:"
79
+ msgstr "Ordre :"
80
+
81
+ #: includes/widget-recent-posts-extended.php:322
82
+ msgid "DESC"
83
+ msgstr "DESC"
84
+
85
+ #: includes/widget-recent-posts-extended.php:323
86
+ msgid "ASC"
87
+ msgstr "ASC"
88
+
89
+ #: includes/widget-recent-posts-extended.php:327
90
+ msgid "Orderby:"
91
+ msgstr "Ordre par :"
92
+
93
+ #: includes/widget-recent-posts-extended.php:329
94
+ msgid "ID"
95
+ msgstr "ID"
96
+
97
+ #: includes/widget-recent-posts-extended.php:330
98
+ msgid "Author"
99
+ msgstr "Auteur"
100
+
101
+ #: includes/widget-recent-posts-extended.php:331
102
+ msgid "Title"
103
+ msgstr "Titre"
104
+
105
+ #: includes/widget-recent-posts-extended.php:332
106
+ msgid "Date"
107
+ msgstr "Date"
108
+
109
+ #: includes/widget-recent-posts-extended.php:333
110
+ msgid "Modified"
111
+ msgstr "Modifié"
112
+
113
+ #: includes/widget-recent-posts-extended.php:334
114
+ msgid "Random"
115
+ msgstr "Au hasard"
116
+
117
+ #: includes/widget-recent-posts-extended.php:335
118
+ msgid "Comment Count"
119
+ msgstr "Décompte des commentaires"
120
+
121
+ #: includes/widget-recent-posts-extended.php:336
122
+ msgid "Menu Order"
123
+ msgstr "Ordre du menu"
124
+
125
+ #: includes/widget-recent-posts-extended.php:340
126
+ msgid "Limit to Category: "
127
+ msgstr "Limiter à une catégorie :"
128
+
129
+ #: includes/widget-recent-posts-extended.php:351
130
+ msgid "Limit to Tag: "
131
+ msgstr "Limiter à un mot clé :"
132
+
133
+ #: includes/widget-recent-posts-extended.php:363
134
+ msgid "Choose the Post Type: "
135
+ msgstr "Choisir le type d'article :"
136
+
137
+ #: includes/widget-recent-posts-extended.php:379
138
+ msgid "Display Thumbnail"
139
+ msgstr "Affichage de la miniature"
140
+
141
+ #: includes/widget-recent-posts-extended.php:383
142
+ msgid "Thumbnail (height, width, align):"
143
+ msgstr "miniature (hauteur, largeur, alignement) :"
144
+
145
+ #: includes/widget-recent-posts-extended.php:387
146
+ msgid "Left"
147
+ msgstr "Gauche"
148
+
149
+ #: includes/widget-recent-posts-extended.php:388
150
+ msgid "Right"
151
+ msgstr "Droite"
152
+
153
+ #: includes/widget-recent-posts-extended.php:389
154
+ msgid "Center"
155
+ msgstr "Centre"
156
+
157
+ #: includes/widget-recent-posts-extended.php:393
158
+ msgid "Default Thumbnail:"
159
+ msgstr "Miniature par défaut :"
160
+
161
+ #: includes/widget-recent-posts-extended.php:395
162
+ msgid "Leave it blank to disable."
163
+ msgstr "Laissez ce champ vide pour désactiver."
164
+
165
+ #: includes/widget-recent-posts-extended.php:401
166
+ msgid "Display Excerpt"
167
+ msgstr "Affichage de l'extrait"
168
+
169
+ #: includes/widget-recent-posts-extended.php:405
170
+ msgid "Excerpt Length:"
171
+ msgstr "Longueur de l'extrait"
172
+
173
+ #: includes/widget-recent-posts-extended.php:409
174
+ msgid "Display Readmore"
175
+ msgstr "Affichage de «Lire la suite»"
176
+
177
+ #: includes/widget-recent-posts-extended.php:413
178
+ msgid "Readmore Text:"
179
+ msgstr "Texte «Lire la suite» :"
180
+
181
+ #: includes/widget-recent-posts-extended.php:417
182
+ msgid "Display Date"
183
+ msgstr "Affichage de la date"
184
+
185
+ #: includes/widget-recent-posts-extended.php:421
186
+ msgid "Date Format:"
187
+ msgstr "Format de date :"
188
+
189
+ #: includes/widget-recent-posts-extended.php:423
190
+ msgid ""
191
+ "<a href=\"http://codex.wordpress.org/Formatting_Date_and_Time\" target="
192
+ "\"_blank\">Date reference</a>"
193
+ msgstr ""
194
+ "<a href=\"http://codex.wordpress.org/Formatting_Date_and_Time\" target="
195
+ "\"_blank\">Référence pour les formats de date</a>"
readme.txt CHANGED
@@ -1,258 +1,261 @@
1
- === Recent Posts Widget Extended ===
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.7
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Provides flexible and advanced recent posts. Display it via shortcode or widget with with thumbnails, post excerpt, taxonomy and more.
12
-
13
- == Description ==
14
-
15
- This plugin will enable a custom, flexible and super advanced recent posts, 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!
16
-
17
- = New Features =
18
-
19
- * WordPress 4.0 Support.
20
- * Shortcode feature. Please read [Other Notes](http://wordpress.org/plugins/recent-posts-widget-extended/other_notes)
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
-
29
- * Allow you to set title url.
30
- * Display by date, comment count or random.
31
- * Display thumbnails, with customizable size and alignment.
32
- * Display excerpt, with customizable length.
33
- * Display from all, specific or multiple category.
34
- * Display from all, specific or multiple tag.
35
- * Display post date.
36
- * Read more option.
37
- * Post type option.
38
- * Custom CSS.
39
- * Multiple widgets.
40
-
41
- = Plugin Support =
42
-
43
- * [Get the Image](http://wordpress.org/plugins/get-the-image/).
44
- * [Page Builder by SiteOrigin](http://wordpress.org/plugins/siteorigin-panels/).
45
- * [Featured Video Plus](http://wordpress.org/plugins/featured-video-plus/).
46
-
47
- = Support =
48
-
49
- * Go to [forum support](http://wordpress.org/support/plugin/recent-posts-widget-extended).
50
- * [Rate/Review the plugin](http://wordpress.org/support/view/plugin-reviews/recent-posts-widget-extended).
51
- * Submit translation.
52
-
53
- = Plugin Info =
54
- * Developed by [Satrya](http://satrya.me/) & [Theme Junkie](http://www.theme-junkie.com/)
55
- * Check out the [Github](https://github.com/satrya/recent-posts-widget-extended) repo to contribute.
56
-
57
- = Posts Plugin Series =
58
- * [Recent Posts Widget Extended](http://wordpress.org/plugins/recent-posts-widget-extended/)
59
- * [Advanced Random Posts Widget](http://wordpress.org/plugins/advanced-random-posts-widget/)
60
-
61
- = Contributors =
62
- * [David Kryzaniak](http://profiles.wordpress.org/davidkryzaniak/)
63
- * [AKbyte](http://profiles.wordpress.org/akbyte/)
64
- * [Alexander Sidorov](https://github.com/lkart)
65
- * [Rubens Mariuzzo](https://github.com/rmariuzzo)
66
-
67
- == Installation ==
68
-
69
- **Through Dashboard**
70
-
71
- 1. Log in to your WordPress admin panel and go to Plugins -> Add New
72
- 2. Type **recent posts widget extended** in the search box and click on search button.
73
- 3. Find Recent Posts Widget Extended plugin.
74
- 4. Then click on Install Now after that activate the plugin.
75
- 5. Go to the widgets page **Appearance -> Widgets**.
76
- 6. Find **Recent Posts Extended** widget.
77
-
78
- **Installing Via FTP**
79
-
80
- 1. Download the plugin to your hardisk.
81
- 2. Unzip.
82
- 3. Upload the **recent-posts-widget-extended** folder into your plugins directory.
83
- 4. Log in to your WordPress admin panel and click the Plugins menu.
84
- 5. Then activate the plugin.
85
- 6. Go to the widgets page **Appearance -> Widgets**.
86
- 7. Find **Recent Posts Extended** widget.
87
-
88
- == Frequently Asked Questions ==
89
-
90
- = How to filter the post query? =
91
- You can use `rpwe_default_query_arguments` to filter it. Example:
92
- `
93
- add_filter( 'rpwe_default_query_arguments', 'your_custom_function' );
94
- function your_custom_function( $args ) {
95
- $args['posts_per_page'] = 10; // Changing the number of posts to show.
96
- return $args;
97
- }
98
- `
99
-
100
- = How to filter the post excerpt? =
101
- Post excerpt now comes with filter to easily dev to change/customize it. `apply_filters( 'rpwe_excerpt', get_the_excerpt() )`
102
-
103
- = Ordering not working! =
104
- 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)
105
-
106
- = No image options =
107
- 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.
108
-
109
- = How to add custom style? =
110
- 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
111
- `
112
- .rpwe-block ul {
113
- list-style: none !important;
114
- margin-left: 0 !important;
115
- padding-left: 0 !important;
116
- }
117
- .rpwe-block li {
118
- border-bottom: 1px solid #eee;
119
- margin-bottom: 10px;
120
- padding-bottom: 10px;
121
- list-style-type: none;
122
- }
123
- .rpwe-block a {
124
- display: inline !important;
125
- text-decoration: none;
126
- }
127
- .rpwe-block h3 {
128
- background: none !important;
129
- clear: none;
130
- margin-bottom: 0 !important;
131
- margin-top: 0 !important;
132
- font-weight: 400;
133
- font-size: 12px !important;
134
- line-height: 1.5em;
135
- }
136
- .rpwe-thumb {
137
- border: 1px solid #eee !important;
138
- box-shadow: none !important;
139
- margin: 2px 10px 2px 0;
140
- padding: 3px !important;
141
- }
142
- .rpwe-summary {
143
- font-size: 12px;
144
- }
145
- .rpwe-time {
146
- color: #bbb;
147
- font-size: 11px;
148
- }
149
- .rpwe-alignleft {
150
- display: inline;
151
- float: left;
152
- }
153
- .rpwe-alignright {
154
- display: inline;
155
- float: right;
156
- }
157
- .rpwe-aligncenter {
158
- display: block;
159
- margin-left: auto;
160
- margin-right: auto;
161
- }
162
- .rpwe-clearfix:before,.rpwe-clearfix:after {
163
- content: "";
164
- display: table !important;
165
- }
166
- .rpwe-clearfix:after {
167
- clear: both;
168
- }
169
- .rpwe-clearfix {
170
- zoom: 1;
171
- }
172
- `
173
-
174
- = Why so many !important in the css code? =
175
- 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.
176
-
177
- = Available filters =
178
- Default arguments
179
- `
180
- rpwe_default_args
181
- `
182
-
183
- Post excerpt
184
- `
185
- rpwe_excerpt
186
- `
187
-
188
- Post markup
189
- `
190
- rpwe_markup
191
- `
192
-
193
- Post query arguments
194
- `
195
- rpwe_default_query_arguments
196
- `
197
-
198
- == Screenshots ==
199
-
200
- 1. The widget settings
201
-
202
- == Shorcode Explanation ==
203
-
204
- Explanation of shortcode options:
205
-
206
- Basic shortcode
207
- `
208
- [rpwe]
209
- `
210
-
211
- Display 10 recent posts
212
- `
213
- [rpwe limit="10"]
214
- `
215
-
216
- Display 10 recent posts with thumbnail
217
- `
218
- [rpwe limit="10" thumb="true"]
219
- `
220
-
221
- **Here's the full default shortcode arguments**
222
- `
223
- limit="5"
224
- offset=""
225
- order="DESC"
226
- orderby="date"
227
- post_type="post"
228
- cat=""
229
- tag=""
230
- taxonomy=""
231
- post_type="post"
232
- post_status="publish"
233
- ignore_sticky="1"
234
- taxonomy=""
235
- excerpt="false"
236
- length="10"
237
- thumb="true"
238
- thumb_height="45"
239
- thumb_width="45"
240
- thumb_default="http://placehold.it/45x45/f0f0f0/ccc"
241
- thumb_align="rpwe-alignleft"
242
- date="true"
243
- readmore="false"
244
- readmore_text="Read More &raquo;"
245
- styles_default="true"
246
- cssID=""
247
- before=""
248
- after=""
249
- `
250
-
251
- == Changelog ==
252
-
253
- = 0.9.7 - 9/13/2014 =
254
- * **Add:** Relative date option `eg: 4 days ago`. Props [George Venios](https://github.com/veniosg)
255
- * **Add:** [Featured Video Plus](http://wordpress.org/plugins/featured-video-plus/) plugin support.
256
- * **Add:** Hide widget if no posts exist.
257
- * **Add:** Fallback to the image attachment if no image url exist in the resizer script.
 
 
 
258
  * **Fix:** Compatibility issue if the user theme use the same code library(Aqua Resizer) and causing blank screen.
1
+ === Recent Posts Widget Extended ===
2
+ Contributors: satrya, themejunkie
3
+ Tags: recent posts, random posts, popular posts, thumbnails, widget, widgets, sidebar, excerpt, category, post tag, taxonomy, post type, post status, shortcode, multiple widgets
4
+ Requires at least: 3.7
5
+ Tested up to: 4.0.1
6
+ Stable tag: 0.9.8
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. Display it via shortcode or widget with with thumbnails, post excerpt, taxonomy and more.
11
+
12
+ == Description ==
13
+
14
+ This plugin will enable a custom, flexible and super advanced recent posts, 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!
15
+
16
+ = New Features =
17
+
18
+ * WordPress 4.0.1 Support.
19
+ * Shortcode feature. Please read [Other Notes](http://wordpress.org/plugins/recent-posts-widget-extended/other_notes)
20
+ * Taxonomy support!
21
+ * Post status option.
22
+ * Custom html or text before and/or after recent posts.
23
+ * Added some filter to allow dev to customize the plugin. Please read [FAQ](http://wordpress.org/plugins/recent-posts-widget-extended/faq).
24
+ * Better image cropping.
25
+
26
+ = Features Include =
27
+
28
+ * Allow you to set title url.
29
+ * Display by date, comment count or random.
30
+ * Display thumbnails, with customizable size and alignment.
31
+ * Display excerpt, with customizable length.
32
+ * Display from all, specific or multiple category.
33
+ * Display from all, specific or multiple tag.
34
+ * Display post date.
35
+ * Read more option.
36
+ * Post type option.
37
+ * Custom CSS.
38
+ * Multiple widgets.
39
+
40
+ = Plugin Support =
41
+
42
+ * [Get the Image](http://wordpress.org/plugins/get-the-image/).
43
+ * [Page Builder by SiteOrigin](http://wordpress.org/plugins/siteorigin-panels/).
44
+ * [Featured Video Plus](http://wordpress.org/plugins/featured-video-plus/).
45
+
46
+ = Support =
47
+
48
+ * Go to [forum support](http://wordpress.org/support/plugin/recent-posts-widget-extended).
49
+ * [Rate/Review the plugin](http://wordpress.org/support/view/plugin-reviews/recent-posts-widget-extended).
50
+ * Submit translation.
51
+
52
+ = Plugin Info =
53
+ * Developed by [Satrya](http://satrya.me/) & [Theme Junkie](http://www.theme-junkie.com/)
54
+ * Check out the [Github](https://github.com/satrya/recent-posts-widget-extended) repo to contribute.
55
+
56
+ = Posts Plugin Series =
57
+ * [Recent Posts Widget Extended](http://wordpress.org/plugins/recent-posts-widget-extended/)
58
+ * [Advanced Random Posts Widget](http://wordpress.org/plugins/advanced-random-posts-widget/)
59
+
60
+ = Contributors =
61
+ * [David Kryzaniak](http://profiles.wordpress.org/davidkryzaniak/)
62
+ * [AKbyte](http://profiles.wordpress.org/akbyte/)
63
+ * [Alexander Sidorov](https://github.com/lkart)
64
+ * [Rubens Mariuzzo](https://github.com/rmariuzzo)
65
+
66
+ == Installation ==
67
+
68
+ **Through Dashboard**
69
+
70
+ 1. Log in to your WordPress admin panel and go to Plugins -> Add New
71
+ 2. Type **recent posts widget extended** in the search box and click on search button.
72
+ 3. Find Recent Posts Widget Extended plugin.
73
+ 4. Then click on Install Now after that activate the plugin.
74
+ 5. Go to the widgets page **Appearance -> Widgets**.
75
+ 6. Find **Recent Posts Extended** widget.
76
+
77
+ **Installing Via FTP**
78
+
79
+ 1. Download the plugin to your hardisk.
80
+ 2. Unzip.
81
+ 3. Upload the **recent-posts-widget-extended** folder into your plugins directory.
82
+ 4. Log in to your WordPress admin panel and click the Plugins menu.
83
+ 5. Then activate the plugin.
84
+ 6. Go to the widgets page **Appearance -> Widgets**.
85
+ 7. Find **Recent Posts Extended** widget.
86
+
87
+ == Frequently Asked Questions ==
88
+
89
+ = How to filter the post query? =
90
+ You can use `rpwe_default_query_arguments` to filter it. Example:
91
+ `
92
+ add_filter( 'rpwe_default_query_arguments', 'your_custom_function' );
93
+ function your_custom_function( $args ) {
94
+ $args['posts_per_page'] = 10; // Changing the number of posts to show.
95
+ return $args;
96
+ }
97
+ `
98
+
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
+
105
+ = No image options =
106
+ 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.
107
+
108
+ = How to add custom style? =
109
+ 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
110
+ `
111
+ .rpwe-block ul {
112
+ list-style: none !important;
113
+ margin-left: 0 !important;
114
+ padding-left: 0 !important;
115
+ }
116
+ .rpwe-block li {
117
+ border-bottom: 1px solid #eee;
118
+ margin-bottom: 10px;
119
+ padding-bottom: 10px;
120
+ list-style-type: none;
121
+ }
122
+ .rpwe-block a {
123
+ display: inline !important;
124
+ text-decoration: none;
125
+ }
126
+ .rpwe-block h3 {
127
+ background: none !important;
128
+ clear: none;
129
+ margin-bottom: 0 !important;
130
+ margin-top: 0 !important;
131
+ font-weight: 400;
132
+ font-size: 12px !important;
133
+ line-height: 1.5em;
134
+ }
135
+ .rpwe-thumb {
136
+ border: 1px solid #eee !important;
137
+ box-shadow: none !important;
138
+ margin: 2px 10px 2px 0;
139
+ padding: 3px !important;
140
+ }
141
+ .rpwe-summary {
142
+ font-size: 12px;
143
+ }
144
+ .rpwe-time {
145
+ color: #bbb;
146
+ font-size: 11px;
147
+ }
148
+ .rpwe-alignleft {
149
+ display: inline;
150
+ float: left;
151
+ }
152
+ .rpwe-alignright {
153
+ display: inline;
154
+ float: right;
155
+ }
156
+ .rpwe-aligncenter {
157
+ display: block;
158
+ margin-left: auto;
159
+ margin-right: auto;
160
+ }
161
+ .rpwe-clearfix:before,.rpwe-clearfix:after {
162
+ content: "";
163
+ display: table !important;
164
+ }
165
+ .rpwe-clearfix:after {
166
+ clear: both;
167
+ }
168
+ .rpwe-clearfix {
169
+ zoom: 1;
170
+ }
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
178
+ `
179
+ rpwe_default_args
180
+ `
181
+
182
+ Post excerpt
183
+ `
184
+ rpwe_excerpt
185
+ `
186
+
187
+ Post markup
188
+ `
189
+ rpwe_markup
190
+ `
191
+
192
+ Post query arguments
193
+ `
194
+ rpwe_default_query_arguments
195
+ `
196
+
197
+ == Screenshots ==
198
+
199
+ 1. The widget settings
200
+
201
+ == Shorcode Explanation ==
202
+
203
+ Explanation of shortcode options:
204
+
205
+ Basic shortcode
206
+ `
207
+ [rpwe]
208
+ `
209
+
210
+ Display 10 recent posts
211
+ `
212
+ [rpwe limit="10"]
213
+ `
214
+
215
+ Display 10 recent posts with thumbnail
216
+ `
217
+ [rpwe limit="10" thumb="true"]
218
+ `
219
+
220
+ **Here's the full default shortcode arguments**
221
+ `
222
+ limit="5"
223
+ offset=""
224
+ order="DESC"
225
+ orderby="date"
226
+ post_type="post"
227
+ cat=""
228
+ tag=""
229
+ taxonomy=""
230
+ post_type="post"
231
+ post_status="publish"
232
+ ignore_sticky="1"
233
+ taxonomy=""
234
+ excerpt="false"
235
+ length="10"
236
+ thumb="true"
237
+ thumb_height="45"
238
+ thumb_width="45"
239
+ thumb_default="http://placehold.it/45x45/f0f0f0/ccc"
240
+ thumb_align="rpwe-alignleft"
241
+ date="true"
242
+ readmore="false"
243
+ readmore_text="Read More &raquo;"
244
+ styles_default="true"
245
+ cssID=""
246
+ before=""
247
+ after=""
248
+ `
249
+
250
+ == Changelog ==
251
+
252
+ = 0.9.8 - 26/11/2014 =
253
+ * **Fix:** Compatibility issue with `Get The Image` plugin/extension.
254
+ * **Fix:** Issue with `html or text before and after recent posts`, now it allow all HTML tags.
255
+
256
+ = 0.9.7 - 9/13/2014 =
257
+ * **Add:** Relative date option `eg: 4 days ago`. Props [George Venios](https://github.com/veniosg)
258
+ * **Add:** [Featured Video Plus](http://wordpress.org/plugins/featured-video-plus/) plugin support.
259
+ * **Add:** Hide widget if no posts exist.
260
+ * **Add:** Fallback to the image attachment if no image url exist in the resizer script.
261
  * **Fix:** Compatibility issue if the user theme use the same code library(Aqua Resizer) and causing blank screen.
rpwe.php CHANGED
@@ -1,135 +1,135 @@
1
- <?php
2
- /**
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
7
- * Author: Satrya
8
- * Author URI: http://satrya.me/
9
- * Author Email: satrya@satrya.me
10
- *
11
- * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
12
- * General Public License as published by the Free Software Foundation; either version 2 of the License,
13
- * or (at your option) any later version.
14
- *
15
- * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
16
- * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
- *
18
- * You should have received a copy of the GNU General Public License along with this program; if not, write
19
- * to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
- *
21
- * @package Recent_Posts_Widget_Extended
22
- * @since 0.1
23
- * @author Satrya
24
- * @copyright Copyright (c) 2014, Satrya
25
- * @license http://www.gnu.org/licenses/gpl-2.0.html
26
- */
27
-
28
- // Exit if accessed directly
29
- if ( ! defined( 'ABSPATH' ) ) exit;
30
-
31
- class RPW_Extended {
32
-
33
- /**
34
- * PHP5 constructor method.
35
- *
36
- * @since 0.1
37
- */
38
- public function __construct() {
39
-
40
- // Set the constants needed by the plugin.
41
- add_action( 'plugins_loaded', array( &$this, 'constants' ), 1 );
42
-
43
- // Internationalize the text strings used.
44
- add_action( 'plugins_loaded', array( &$this, 'i18n' ), 2 );
45
-
46
- // Load the functions files.
47
- add_action( 'plugins_loaded', array( &$this, 'includes' ), 3 );
48
-
49
- // Load the admin style.
50
- add_action( 'admin_enqueue_scripts', array( &$this, 'admin_style' ) );
51
-
52
- // Register widget.
53
- add_action( 'widgets_init', array( &$this, 'register_widget' ) );
54
-
55
- // Register new image size.
56
- add_action( 'init', array( &$this, 'register_image_size' ) );
57
-
58
- }
59
-
60
- /**
61
- * Defines constants used by the plugin.
62
- *
63
- * @since 0.1
64
- */
65
- public function constants() {
66
-
67
- // Set constant path to the plugin directory.
68
- define( 'RPWE_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
69
-
70
- // Set the constant path to the plugin directory URI.
71
- define( 'RPWE_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
72
-
73
- // Set the constant path to the includes directory.
74
- define( 'RPWE_INCLUDES', RPWE_DIR . trailingslashit( 'includes' ) );
75
-
76
- // Set the constant path to the includes directory.
77
- define( 'RPWE_CLASS', RPWE_DIR . trailingslashit( 'classes' ) );
78
-
79
- // Set the constant path to the assets directory.
80
- define( 'RPWE_ASSETS', RPWE_URI . trailingslashit( 'assets' ) );
81
-
82
- }
83
-
84
- /**
85
- * Loads the translation files.
86
- *
87
- * @since 0.1
88
- */
89
- public function i18n() {
90
- load_plugin_textdomain( 'rpwe', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
91
- }
92
-
93
- /**
94
- * Loads the initial files needed by the plugin.
95
- *
96
- * @since 0.1
97
- */
98
- public function includes() {
99
- require_once( RPWE_INCLUDES . 'resizer.php' );
100
- require_once( RPWE_INCLUDES . 'functions.php' );
101
- require_once( RPWE_INCLUDES . 'shortcode.php' );
102
- }
103
-
104
- /**
105
- * Register custom style for the widget settings.
106
- *
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
- /**
115
- * Register the widget.
116
- *
117
- * @since 0.9.1
118
- */
119
- public function register_widget() {
120
- require_once( RPWE_CLASS . 'widget.php' );
121
- register_widget( 'Recent_Posts_Widget_Extended' );
122
- }
123
-
124
- /**
125
- * Register new image size.
126
- *
127
- * @since 0.9.4
128
- */
129
- function register_image_size() {
130
- add_image_size( 'rpwe-thumbnail', 45, 45, true );
131
- }
132
-
133
- }
134
-
135
  new RPW_Extended;
1
+ <?php
2
+ /**
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.8
7
+ * Author: Satrya
8
+ * Author URI: http://satrya.me/
9
+ * Author Email: satrya@satrya.me
10
+ *
11
+ * This program is free software; you can redistribute it and/or modify it under the terms of the GNU
12
+ * General Public License as published by the Free Software Foundation; either version 2 of the License,
13
+ * or (at your option) any later version.
14
+ *
15
+ * This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
16
+ * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
17
+ *
18
+ * You should have received a copy of the GNU General Public License along with this program; if not, write
19
+ * to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
20
+ *
21
+ * @package Recent_Posts_Widget_Extended
22
+ * @since 0.1
23
+ * @author Satrya
24
+ * @copyright Copyright (c) 2014, Satrya
25
+ * @license http://www.gnu.org/licenses/gpl-2.0.html
26
+ */
27
+
28
+ // Exit if accessed directly
29
+ if ( ! defined( 'ABSPATH' ) ) exit;
30
+
31
+ class RPW_Extended {
32
+
33
+ /**
34
+ * PHP5 constructor method.
35
+ *
36
+ * @since 0.1
37
+ */
38
+ public function __construct() {
39
+
40
+ // Set the constants needed by the plugin.
41
+ add_action( 'plugins_loaded', array( &$this, 'constants' ), 1 );
42
+
43
+ // Internationalize the text strings used.
44
+ add_action( 'plugins_loaded', array( &$this, 'i18n' ), 2 );
45
+
46
+ // Load the functions files.
47
+ add_action( 'plugins_loaded', array( &$this, 'includes' ), 3 );
48
+
49
+ // Load the admin style.
50
+ add_action( 'admin_enqueue_scripts', array( &$this, 'admin_style' ) );
51
+
52
+ // Register widget.
53
+ add_action( 'widgets_init', array( &$this, 'register_widget' ) );
54
+
55
+ // Register new image size.
56
+ add_action( 'init', array( &$this, 'register_image_size' ) );
57
+
58
+ }
59
+
60
+ /**
61
+ * Defines constants used by the plugin.
62
+ *
63
+ * @since 0.1
64
+ */
65
+ public function constants() {
66
+
67
+ // Set constant path to the plugin directory.
68
+ define( 'RPWE_DIR', trailingslashit( plugin_dir_path( __FILE__ ) ) );
69
+
70
+ // Set the constant path to the plugin directory URI.
71
+ define( 'RPWE_URI', trailingslashit( plugin_dir_url( __FILE__ ) ) );
72
+
73
+ // Set the constant path to the includes directory.
74
+ define( 'RPWE_INCLUDES', RPWE_DIR . trailingslashit( 'includes' ) );
75
+
76
+ // Set the constant path to the includes directory.
77
+ define( 'RPWE_CLASS', RPWE_DIR . trailingslashit( 'classes' ) );
78
+
79
+ // Set the constant path to the assets directory.
80
+ define( 'RPWE_ASSETS', RPWE_URI . trailingslashit( 'assets' ) );
81
+
82
+ }
83
+
84
+ /**
85
+ * Loads the translation files.
86
+ *
87
+ * @since 0.1
88
+ */
89
+ public function i18n() {
90
+ load_plugin_textdomain( 'rpwe', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
91
+ }
92
+
93
+ /**
94
+ * Loads the initial files needed by the plugin.
95
+ *
96
+ * @since 0.1
97
+ */
98
+ public function includes() {
99
+ require_once( RPWE_INCLUDES . 'resizer.php' );
100
+ require_once( RPWE_INCLUDES . 'functions.php' );
101
+ require_once( RPWE_INCLUDES . 'shortcode.php' );
102
+ }
103
+
104
+ /**
105
+ * Register custom style for the widget settings.
106
+ *
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
+ /**
115
+ * Register the widget.
116
+ *
117
+ * @since 0.9.1
118
+ */
119
+ public function register_widget() {
120
+ require_once( RPWE_CLASS . 'widget.php' );
121
+ register_widget( 'Recent_Posts_Widget_Extended' );
122
+ }
123
+
124
+ /**
125
+ * Register new image size.
126
+ *
127
+ * @since 0.9.4
128
+ */
129
+ function register_image_size() {
130
+ add_image_size( 'rpwe-thumbnail', 45, 45, true );
131
+ }
132
+
133
+ }
134
+
135
  new RPW_Extended;
screenshot-1.png CHANGED
Binary file