Category Posts Widget - Version 4.1.4

Version Description

  • Please consider to re-configure the widget as the latest version has numerous changes from previous.
  • Version 4.0 uses CSS file for styling the widget in front end.
  • Version 3.0 or later version uses WordPress 2.9's built in post thumbnail functionality.
Download this release

Release Info

Developer Kometschuh
Plugin Icon 128x128 Category Posts Widget
Version 4.1.4
Comparing to
See all releases

Code changes from version 4.1.3 to 4.1.4

Files changed (3) hide show
  1. cat-posts.css +14 -9
  2. cat-posts.php +445 -364
  3. readme.txt +155 -136
cat-posts.css CHANGED
@@ -1,22 +1,27 @@
1
  /*
2
  Default CSS Styles for the Category Posts Widget plugin
3
- Version: 4.1.3
4
  */
5
- .cat-post-current,
6
- .cat-post-date,
7
- .cat-post-comment-num {
8
- font-size: 12px;
9
- line-height: 18px;
10
- }
11
  .cat-post-title {
12
- font-size: 15px;
 
13
  }
14
- .cat-post-current a {
15
  font-weight: bold;
16
  text-transform: uppercase;
17
  }
 
 
 
 
 
 
 
 
18
  .cat-post-date {
19
  font-style: italic;
 
 
20
  margin-bottom: 0;
21
  }
22
  .cat-post-thumbnail img {
1
  /*
2
  Default CSS Styles for the Category Posts Widget plugin
3
+ Version: 4.1.4
4
  */
 
 
 
 
 
 
5
  .cat-post-title {
6
+ font-size: 15px;
7
+ font-size: 0.9375rem;
8
  }
9
+ .cat-post-current .cat-post-title {
10
  font-weight: bold;
11
  text-transform: uppercase;
12
  }
13
+ .cat-post-date,
14
+ .cat-post-comment-num {
15
+ font-size: 12px;
16
+ font-size: 0.75rem;
17
+ line-height: 18px;
18
+ line-height: 1.125rem;
19
+ margin-bottom: 0;
20
+ }
21
  .cat-post-date {
22
  font-style: italic;
23
+ }
24
+ .cat-post-author {
25
  margin-bottom: 0;
26
  }
27
  .cat-post-thumbnail img {
cat-posts.php CHANGED
@@ -1,364 +1,445 @@
1
- <?php
2
- /*
3
- Plugin Name: Category Posts Widget
4
- Plugin URI: http://mkrdip.me/category-posts-widget
5
- Description: Adds a widget that shows the most recent posts from a single category.
6
- Author: Mrinal Kanti Roy
7
- Version: 4.1.3
8
- Author URI: http://mkrdip.me
9
- */
10
-
11
- // Don't call the file directly
12
- if ( !defined( 'ABSPATH' ) ) exit;
13
-
14
- /**
15
- * Register our styles
16
- *
17
- * @return void
18
- */
19
- add_action( 'wp_enqueue_scripts', 'category_posts_widget_styles' );
20
-
21
- function category_posts_widget_styles() {
22
- wp_register_style( 'category-posts', plugins_url( 'category-posts/cat-posts.css' ) );
23
- wp_enqueue_style( 'category-posts' );
24
- }
25
-
26
- /**
27
- * Register thumbnail sizes.
28
- *
29
- * @return void
30
- */
31
- function category_posts_add_image_size(){
32
- $sizes = get_option('mkrdip_cat_post_thumb_sizes');
33
-
34
- if ( $sizes ){
35
- foreach ( $sizes as $id=>$size ) {
36
- add_image_size( 'cat_post_thumb_size' . $id, $size[0], $size[1], true );
37
- }
38
- }
39
- }
40
-
41
- add_action( 'init', 'category_posts_add_image_size' );
42
-
43
-
44
- /**
45
- * Category Posts Widget Class
46
- *
47
- * Shows the single category posts with some configurable options
48
- */
49
- class CategoryPosts extends WP_Widget {
50
-
51
- function __construct() {
52
- $widget_ops = array('classname' => 'cat-post-widget', 'description' => __('List single category posts'));
53
- parent::__construct('category-posts', __('Category Posts'), $widget_ops);
54
- }
55
-
56
- // Displays category posts widget on blog.
57
- function widget($args, $instance) {
58
- global $post;
59
- $post_old = $post; // Save the post object.
60
-
61
- extract( $args );
62
-
63
- $sizes = get_option('mkrdip_cat_post_thumb_sizes');
64
-
65
- // If not title, use the name of the category.
66
- if( !$instance["title"] ) {
67
- $category_info = get_category($instance["cat"]);
68
- $instance["title"] = $category_info->name;
69
- }
70
-
71
- $valid_sort_orders = array('date', 'title', 'comment_count', 'rand');
72
- if ( in_array($instance['sort_by'], $valid_sort_orders) ) {
73
- $sort_by = $instance['sort_by'];
74
- $sort_order = (bool) isset( $instance['asc_sort_order'] ) ? 'ASC' : 'DESC';
75
- } else {
76
- // by default, display latest first
77
- $sort_by = 'date';
78
- $sort_order = 'DESC';
79
- }
80
-
81
- // Get array of post info.
82
- $cat_posts = new WP_Query(
83
- "showposts=" . $instance["num"] .
84
- "&cat=" . $instance["cat"] .
85
- "&orderby=" . $sort_by .
86
- "&order=" . $sort_order
87
- );
88
-
89
- if ( !isset ( $instance["hide_if_empty"] ) || $cat_posts->have_posts() ) {
90
-
91
- // Excerpt length filter
92
- $new_excerpt_length = create_function('$length', "return " . $instance["excerpt_length"] . ";");
93
- if ( $instance["excerpt_length"] > 0 )
94
- add_filter('excerpt_length', $new_excerpt_length);
95
-
96
- echo $before_widget;
97
-
98
- // Widget title
99
- if( !isset ( $instance["hide_title"] ) ) {
100
- echo $before_title;
101
- if( isset ( $instance["title_link"] ) ) {
102
- echo '<a href="' . get_category_link($instance["cat"]) . '">' . $instance["title"] . '</a>';
103
- } else {
104
- echo $instance["title"];
105
- }
106
- echo $after_title;
107
- }
108
-
109
- // Post list
110
- echo "<ul>\n";
111
-
112
- while ( $cat_posts->have_posts() )
113
- {
114
- $cat_posts->the_post(); ?>
115
-
116
- <li <?php if( !isset( $instance['disable_css'] ) ) {
117
- echo "class=\"cat-post-item";
118
- if ( is_single(get_the_title() ) ) { echo " cat-post-current"; }
119
- echo "\"";
120
- } ?> >
121
-
122
- <?php
123
- if( isset( $instance["thumbTop"] ) ) :
124
- if ( function_exists('the_post_thumbnail') &&
125
- current_theme_supports("post-thumbnails") &&
126
- isset( $instance["thumb"] ) &&
127
- has_post_thumbnail() ) : ?>
128
- <a <?php if( !isset( $instance['disable_css'] ) ) { echo "class=\"cat-post-thumbnail\""; } ?>
129
- href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
130
- <?php the_post_thumbnail( 'cat_post_thumb_size'.$this->id ); ?>
131
- </a>
132
- <?php endif;
133
- endif; ?>
134
-
135
- <a class="post-title <?php if( !isset( $instance['disable_css'] ) ) { echo " cat-post-title"; } ?>"
136
- href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>
137
- </a>
138
-
139
- <?php if ( isset( $instance['date'] ) ) : ?>
140
- <p class="post-date <?php if( !isset( $instance['disable_css'] ) ) { echo " cat-post-date"; } ?>">
141
- <?php the_time("j M Y"); ?>
142
- </p>
143
- <?php endif;
144
-
145
- if( !isset( $instance["thumbTop"] ) ) :
146
- if ( function_exists('the_post_thumbnail') &&
147
- current_theme_supports("post-thumbnails") &&
148
- isset( $instance["thumb"] ) &&
149
- has_post_thumbnail() ) : ?>
150
- <a <?php if( !isset( $instance['disable_css'] ) ) { echo "class=\"cat-post-thumbnail\""; } ?>
151
- href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
152
- <?php the_post_thumbnail( 'cat_post_thumb_size'.$this->id ); ?>
153
- </a>
154
- <?php endif;
155
- endif;
156
-
157
- if ( isset( $instance['excerpt'] ) ) :
158
- the_excerpt();
159
- endif;
160
-
161
- if ( isset( $instance['comment_num'] ) ) : ?>
162
- <p class="comment-num <?php if( !isset( $instance['disable_css'] ) ) { echo "cat-post-comment-num"; } ?>">
163
- (<?php comments_number(); ?>)
164
- </p>
165
- <?php endif; ?>
166
- </li>
167
- <?php
168
- }
169
-
170
- echo "</ul>\n";
171
-
172
- echo $after_widget;
173
-
174
- remove_filter('excerpt_length', $new_excerpt_length);
175
-
176
- if (function_exists ('wp_reset_postdata')) //wp_reset_postdata only exists in WordPress >3.0.0
177
- wp_reset_postdata();
178
-
179
- } // END if !isset ( $instance["hide_if_empty"] ) || $cat_posts->have_posts()
180
- }
181
-
182
- /**
183
- * Update the options
184
- *
185
- * @param array $new_instance
186
- * @param array $old_instance
187
- * @return array
188
- */
189
- function update($new_instance, $old_instance) {
190
-
191
- // thumbnail size
192
- $sizes = get_option('mkrdip_cat_post_thumb_sizes');
193
- if ( !$sizes ) {
194
- $sizes = array();
195
- }
196
- $sizes[$this->id] = array($new_instance['thumb_w'], $new_instance['thumb_h']);
197
- update_option('mkrdip_cat_post_thumb_sizes', $sizes);
198
-
199
- return $new_instance;
200
- }
201
-
202
- /**
203
- * The widget configuration form back end.
204
- *
205
- * @param array $instance
206
- * @return void
207
- */
208
- function form($instance) {
209
- $instance = wp_parse_args( ( array ) $instance, array(
210
- 'title' => __( '' ),
211
- 'hide_title' => __( '' ),
212
- 'cat' => __( '' ),
213
- 'num' => __( '' ),
214
- 'sort_by' => __( '' ),
215
- 'asc_sort_order' => __( '' ),
216
- 'title_link' => __( '' ),
217
- 'excerpt' => __( '' ),
218
- 'excerpt_length' => __( '' ),
219
- 'comment_num' => __( '' ),
220
- 'date' => __( '' ),
221
- 'thumb' => __( '' ),
222
- 'thumbTop' => __( '' ),
223
- 'thumb_w' => __( '' ),
224
- 'thumb_h' => __( '' ),
225
- 'disable_css' => __( '' ),
226
- 'hide_if_empty' => __( '' )
227
- ) );
228
-
229
- $title = $instance['title'];
230
- $hide_title = $instance['hide_title'];
231
- $cat = $instance['cat'];
232
- $num = $instance['num'];
233
- $sort_by = $instance['sort_by'];
234
- $asc_sort_order = $instance['asc_sort_order'];
235
- $title_link = $instance['title_link'];
236
- $excerpt = $instance['excerpt'];
237
- $excerpt_length = $instance['excerpt_length'];
238
- $comment_num = $instance['comment_num'];
239
- $date = $instance['date'];
240
- $thumb = $instance['thumb'];
241
- $thumbTop = $instance['thumbTop'];
242
- $thumb_w = $instance['thumb_w'];
243
- $thumb_h = $instance['thumb_h'];
244
- $disable_css = $instance['disable_css'];
245
- $hide_if_empty = $instance['hide_if_empty'];
246
-
247
- ?>
248
- <p>
249
- <label for="<?php echo $this->get_field_id("title"); ?>">
250
- <?php _e( 'Title' ); ?>:
251
- <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"]); ?>" />
252
- </label>
253
- </p>
254
- <p>
255
- <label for="<?php echo $this->get_field_id("hide_title"); ?>">
256
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("hide_title"); ?>" name="<?php echo $this->get_field_name("hide_title"); ?>"<?php checked( (bool) $instance["hide_title"], true ); ?> />
257
- <?php _e( 'Hide title' ); ?>
258
- </label>
259
- </p>
260
- <p>
261
- <label for="<?php echo $this->get_field_id("title_link"); ?>">
262
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("title_link"); ?>" name="<?php echo $this->get_field_name("title_link"); ?>"<?php checked( (bool) $instance["title_link"], true ); ?> />
263
- <?php _e( 'Make widget title link' ); ?>
264
- </label>
265
- </p>
266
- <p>
267
- <label>
268
- <?php _e( 'Category' ); ?>:
269
- <?php wp_dropdown_categories( array( 'name' => $this->get_field_name("cat"), 'selected' => $instance["cat"] ) ); ?>
270
- </label>
271
- </p>
272
- <p>
273
- <label for="<?php echo $this->get_field_id("num"); ?>">
274
- <?php _e('Number of posts to show'); ?>:
275
- <input style="text-align: center;" id="<?php echo $this->get_field_id("num"); ?>" name="<?php echo $this->get_field_name("num"); ?>" type="text" value="<?php echo absint($instance["num"]); ?>" size='3' />
276
- </label>
277
- </p>
278
- <p>
279
- <label for="<?php echo $this->get_field_id("sort_by"); ?>">
280
- <?php _e('Sort by'); ?>:
281
- <select id="<?php echo $this->get_field_id("sort_by"); ?>" name="<?php echo $this->get_field_name("sort_by"); ?>">
282
- <option value="date"<?php selected( $instance["sort_by"], "date" ); ?>>Date</option>
283
- <option value="title"<?php selected( $instance["sort_by"], "title" ); ?>>Title</option>
284
- <option value="comment_count"<?php selected( $instance["sort_by"], "comment_count" ); ?>>Number of comments</option>
285
- <option value="rand"<?php selected( $instance["sort_by"], "rand" ); ?>>Random</option>
286
- </select>
287
- </label>
288
- </p>
289
- <p>
290
- <label for="<?php echo $this->get_field_id("asc_sort_order"); ?>">
291
- <input type="checkbox" class="checkbox"
292
- id="<?php echo $this->get_field_id("asc_sort_order"); ?>"
293
- name="<?php echo $this->get_field_name("asc_sort_order"); ?>"
294
- <?php checked( (bool) $instance["asc_sort_order"], true ); ?> />
295
- <?php _e( 'Reverse sort order (ascending)' ); ?>
296
- </label>
297
- </p>
298
- <p>
299
- <label for="<?php echo $this->get_field_id("excerpt"); ?>">
300
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("excerpt"); ?>" name="<?php echo $this->get_field_name("excerpt"); ?>"<?php checked( (bool) $instance["excerpt"], true ); ?> />
301
- <?php _e( 'Show post excerpt' ); ?>
302
- </label>
303
- </p>
304
- <p>
305
- <label for="<?php echo $this->get_field_id("excerpt_length"); ?>">
306
- <?php _e( 'Excerpt length (in words):' ); ?>
307
- </label>
308
- <input style="text-align: center;" type="text" id="<?php echo $this->get_field_id("excerpt_length"); ?>" name="<?php echo $this->get_field_name("excerpt_length"); ?>" value="<?php echo $instance["excerpt_length"]; ?>" size="3" />
309
- </p>
310
- <p>
311
- <label for="<?php echo $this->get_field_id("comment_num"); ?>">
312
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("comment_num"); ?>" name="<?php echo $this->get_field_name("comment_num"); ?>"<?php checked( (bool) $instance["comment_num"], true ); ?> />
313
- <?php _e( 'Show number of comments' ); ?>
314
- </label>
315
- </p>
316
- <p>
317
- <label for="<?php echo $this->get_field_id("date"); ?>">
318
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("date"); ?>" name="<?php echo $this->get_field_name("date"); ?>"<?php checked( (bool) $instance["date"], true ); ?> />
319
- <?php _e( 'Show post date' ); ?>
320
- </label>
321
- </p>
322
- <?php if ( function_exists('the_post_thumbnail') && current_theme_supports("post-thumbnails") ) : ?>
323
- <p>
324
- <label for="<?php echo $this->get_field_id("thumb"); ?>">
325
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("thumb"); ?>" name="<?php echo $this->get_field_name("thumb"); ?>"<?php checked( (bool) $instance["thumb"], true ); ?> />
326
- <?php _e( 'Show post thumbnail' ); ?>
327
- </label>
328
- </p>
329
- <p>
330
- <label for="<?php echo $this->get_field_id("thumbTop"); ?>">
331
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("thumbTop"); ?>" name="<?php echo $this->get_field_name("thumbTop"); ?>"<?php checked( (bool) $instance["thumbTop"], true ); ?> />
332
- <?php _e( 'Thumbnail to top' ); ?>
333
- </label>
334
- </p>
335
- <p>
336
- <label>
337
- <?php _e('Thumbnail dimensions (in pixels)'); ?>:<br />
338
- <label for="<?php echo $this->get_field_id("thumb_w"); ?>">
339
- Width: <input class="widefat" style="width:30%;" type="text" id="<?php echo $this->get_field_id("thumb_w"); ?>" name="<?php echo $this->get_field_name("thumb_w"); ?>" value="<?php echo $instance["thumb_w"]; ?>" />
340
- </label>
341
-
342
- <label for="<?php echo $this->get_field_id("thumb_h"); ?>">
343
- Height: <input class="widefat" style="width:30%;" type="text" id="<?php echo $this->get_field_id("thumb_h"); ?>" name="<?php echo $this->get_field_name("thumb_h"); ?>" value="<?php echo $instance["thumb_h"]; ?>" />
344
- </label>
345
- </label>
346
- </p>
347
- <?php endif; ?>
348
- <p>
349
- <label for="<?php echo $this->get_field_id("disable_css"); ?>">
350
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("disable_css"); ?>" name="<?php echo $this->get_field_name("disable_css"); ?>"<?php checked( (bool) $instance["disable_css"], true ); ?> />
351
- <?php _e( 'Disable widget CSS' ); ?>
352
- </label>
353
- </p>
354
- <p>
355
- <label for="<?php echo $this->get_field_id("hide_if_empty"); ?>">
356
- <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("hide_if_empty"); ?>" name="<?php echo $this->get_field_name("hide_if_empty"); ?>"<?php checked( (bool) $instance["hide_if_empty"], true ); ?> />
357
- <?php _e( 'Hide if empty' ); ?>
358
- </label>
359
- </p>
360
- <?php
361
- }
362
- }
363
-
364
- add_action( 'widgets_init', create_function('', 'return register_widget("CategoryPosts");') );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Plugin Name: Category Posts Widget
4
+ Plugin URI: http://mkrdip.me/category-posts-widget
5
+ Description: Adds a widget that shows the most recent posts from a single category.
6
+ Author: Mrinal Kanti Roy
7
+ Version: 4.1.4
8
+ Author URI: http://mkrdip.me
9
+ */
10
+
11
+ // Don't call the file directly
12
+ if ( !defined( 'ABSPATH' ) ) exit;
13
+
14
+ /**
15
+ * Register our styles
16
+ *
17
+ * @return void
18
+ */
19
+ add_action( 'wp_enqueue_scripts', 'category_posts_widget_styles' );
20
+
21
+ function category_posts_widget_styles() {
22
+ wp_register_style( 'category-posts', plugins_url( 'category-posts/cat-posts.css' ) );
23
+ wp_enqueue_style( 'category-posts' );
24
+ }
25
+
26
+ /**
27
+ * Register thumbnail sizes.
28
+ *
29
+ * @return void
30
+ */
31
+ function category_posts_add_image_size(){
32
+ $sizes = get_option('mkrdip_cat_post_thumb_sizes');
33
+
34
+ if ( $sizes ){
35
+ foreach ( $sizes as $id=>$size ) {
36
+ add_image_size( 'cat_post_thumb_size' . $id, $size[0], $size[1], true );
37
+ }
38
+ }
39
+ }
40
+
41
+ add_action( 'init', 'category_posts_add_image_size' );
42
+
43
+
44
+ /**
45
+ * Category Posts Widget Class
46
+ *
47
+ * Shows the single category posts with some configurable options
48
+ */
49
+ class CategoryPosts extends WP_Widget {
50
+
51
+ function __construct() {
52
+ $widget_ops = array('classname' => 'cat-post-widget', 'description' => __('List single category posts'));
53
+ parent::__construct('category-posts', __('Category Posts'), $widget_ops);
54
+ }
55
+
56
+ // Displays category posts widget on blog.
57
+ function widget($args, $instance) {
58
+ global $post;
59
+ $post_old = $post; // Save the post object.
60
+
61
+ extract( $args );
62
+
63
+ $sizes = get_option('mkrdip_cat_post_thumb_sizes');
64
+
65
+ // If not title, use the name of the category.
66
+ if( !$instance["title"] ) {
67
+ $category_info = get_category($instance["cat"]);
68
+ $instance["title"] = $category_info->name;
69
+ }
70
+
71
+ $valid_sort_orders = array('date', 'title', 'comment_count', 'rand');
72
+ if ( in_array($instance['sort_by'], $valid_sort_orders) ) {
73
+ $sort_by = $instance['sort_by'];
74
+ $sort_order = (bool) isset( $instance['asc_sort_order'] ) ? 'ASC' : 'DESC';
75
+ } else {
76
+ // by default, display latest first
77
+ $sort_by = 'date';
78
+ $sort_order = 'DESC';
79
+ }
80
+
81
+ // Exclude current post
82
+ $current_post_id = get_the_ID();
83
+ $exclude_current_post = (isset( $instance['exclude_current_post'] ) && $instance['exclude_current_post'] != -1) ? $current_post_id : "";
84
+
85
+ // Get array of post info.
86
+ $args = array(
87
+ 'showposts' => $instance["num"],
88
+ 'cat' => $instance["cat"],
89
+ 'post__not_in' => array( $exclude_current_post ),
90
+ 'orderby' => $sort_by,
91
+ 'order' => $sort_order
92
+ );
93
+
94
+ if( isset( $instance['hideNoThumb'] ) ) {
95
+ $args = array_merge( $args, array( 'meta_query' => array(
96
+ array(
97
+ 'key' => '_thumbnail_id',
98
+ 'compare' => 'EXISTS' )
99
+ )
100
+ )
101
+ );
102
+ }
103
+
104
+ $cat_posts = new WP_Query( $args );
105
+
106
+ if ( !isset ( $instance["hide_if_empty"] ) || $cat_posts->have_posts() ) {
107
+
108
+ // Excerpt length filter
109
+ $new_excerpt_length = create_function('$length', "return " . $instance["excerpt_length"] . ";");
110
+ if ( $instance["excerpt_length"] > 0 )
111
+ add_filter('excerpt_length', $new_excerpt_length);
112
+
113
+ echo $before_widget;
114
+
115
+ // Widget title
116
+ if( !isset ( $instance["hide_title"] ) ) {
117
+ echo $before_title;
118
+ if( isset ( $instance["title_link"] ) ) {
119
+ echo '<a href="' . get_category_link($instance["cat"]) . '">' . $instance["title"] . '</a>';
120
+ } else {
121
+ echo $instance["title"];
122
+ }
123
+ echo $after_title;
124
+ }
125
+
126
+ // Post list
127
+ echo "<ul>\n";
128
+
129
+ while ( $cat_posts->have_posts() )
130
+ {
131
+ $cat_posts->the_post(); ?>
132
+
133
+ <li <?php if( !isset( $instance['disable_css'] ) ) {
134
+ echo "class=\"cat-post-item";
135
+ if ( is_single(get_the_title() ) ) { echo " cat-post-current"; }
136
+ echo "\"";
137
+ } ?> >
138
+
139
+ <?php
140
+ if( isset( $instance["thumbTop"] ) ) :
141
+ if ( function_exists('the_post_thumbnail') &&
142
+ current_theme_supports("post-thumbnails") &&
143
+ isset( $instance["thumb"] ) &&
144
+ has_post_thumbnail() ) : ?>
145
+ <a <?php if( !isset( $instance['disable_css'] ) ) { echo "class=\"cat-post-thumbnail\""; } ?>
146
+ href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
147
+ <?php the_post_thumbnail( 'cat_post_thumb_size'.$this->id ); ?>
148
+ </a>
149
+ <?php endif;
150
+ endif; ?>
151
+
152
+ <a class="post-title <?php if( !isset( $instance['disable_css'] ) ) { echo " cat-post-title"; } ?>"
153
+ href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?>
154
+ </a>
155
+
156
+ <?php if ( isset( $instance['date'] ) ) : ?>
157
+ <?php if ( isset( $instance['date_format'] ) && strlen( trim( $instance['date_format'] ) ) > 0 ) { $date_format = $instance['date_format']; } else { $date_format = "j M Y"; } ?>
158
+ <p class="post-date <?php if( !isset( $instance['disable_css'] ) ) { echo "cat-post-date"; } ?>">
159
+ <?php if( isset ( $instance["date_link"] ) ) { ?> <a href="<?php the_permalink(); ?>"><?php } ?>
160
+ <?php the_time($date_format); ?>
161
+ <?php if( isset ( $instance["date_link"] ) ) { echo "</a>"; } ?>
162
+ </p>
163
+ <?php endif;
164
+
165
+ if( !isset( $instance["thumbTop"] ) ) :
166
+ if ( function_exists('the_post_thumbnail') &&
167
+ current_theme_supports("post-thumbnails") &&
168
+ isset( $instance["thumb"] ) &&
169
+ has_post_thumbnail() ) : ?>
170
+ <a <?php if( !isset( $instance['disable_css'] ) ) { echo "class=\"cat-post-thumbnail\""; } ?>
171
+ href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
172
+ <?php the_post_thumbnail( 'cat_post_thumb_size'.$this->id ); ?>
173
+ </a>
174
+ <?php endif;
175
+ endif;
176
+
177
+ if ( isset( $instance['excerpt'] ) ) :
178
+ the_excerpt();
179
+ endif;
180
+
181
+ if ( isset( $instance['comment_num'] ) ) : ?>
182
+ <p class="comment-num <?php if( !isset( $instance['disable_css'] ) ) { echo "cat-post-comment-num"; } ?>">
183
+ (<?php comments_number(); ?>)
184
+ </p>
185
+ <?php endif;
186
+
187
+ if ( isset( $instance['author'] ) ) : ?>
188
+ <p class="post-author <?php if( !isset( $instance['disable_css'] ) ) { echo "cat-post-author"; } ?>">
189
+ <?php the_author_posts_link(); ?>
190
+ </p>
191
+ <?php endif; ?>
192
+ </li>
193
+ <?php
194
+ }
195
+
196
+ echo "</ul>\n";
197
+
198
+ // Footer link to category page
199
+ if( isset ( $instance["footer_link"] ) ) {
200
+ echo "<a";
201
+ if( !isset( $instance['disable_css'] ) ) { echo " class:\"cat-post-footer-link\""; }
202
+ echo " href=\"" . get_category_link($instance["cat"]) . "\">" . $instance["footer_link"] . "</a>";
203
+ }
204
+
205
+ echo $after_widget;
206
+
207
+ remove_filter('excerpt_length', $new_excerpt_length);
208
+
209
+ if (function_exists ('wp_reset_postdata')) //wp_reset_postdata only exists in WordPress >3.0.0
210
+ wp_reset_postdata();
211
+
212
+ } // END if
213
+ } // END function
214
+
215
+ /**
216
+ * Update the options
217
+ *
218
+ * @param array $new_instance
219
+ * @param array $old_instance
220
+ * @return array
221
+ */
222
+ function update($new_instance, $old_instance) {
223
+
224
+ // thumbnail size
225
+ $sizes = get_option('mkrdip_cat_post_thumb_sizes');
226
+ if ( !$sizes ) {
227
+ $sizes = array();
228
+ }
229
+ $sizes[$this->id] = array($new_instance['thumb_w'], $new_instance['thumb_h']);
230
+ update_option('mkrdip_cat_post_thumb_sizes', $sizes);
231
+
232
+ return $new_instance;
233
+ }
234
+
235
+ /**
236
+ * The widget configuration form back end.
237
+ *
238
+ * @param array $instance
239
+ * @return void
240
+ */
241
+ function form($instance) {
242
+ $instance = wp_parse_args( ( array ) $instance, array(
243
+ 'title' => __( '' ),
244
+ 'hide_title' => __( '' ),
245
+ 'cat' => __( '' ),
246
+ 'num' => __( '' ),
247
+ 'sort_by' => __( '' ),
248
+ 'asc_sort_order' => __( '' ),
249
+ 'exclude_current_post' => __( '' ),
250
+ 'title_link' => __( '' ),
251
+ 'footer_link' => __( '' ),
252
+ 'excerpt' => __( '' ),
253
+ 'excerpt_length' => __( '' ),
254
+ 'comment_num' => __( '' ),
255
+ 'author' => __( '' ),
256
+ 'date' => __( '' ),
257
+ 'date_link' => __( '' ),
258
+ 'date_format' => __( '' ),
259
+ 'thumb' => __( '' ),
260
+ 'thumbTop' => __( '' ),
261
+ 'hideNoThumb' => __( '' ),
262
+ 'thumb_w' => __( '' ),
263
+ 'thumb_h' => __( '' ),
264
+ 'disable_css' => __( '' ),
265
+ 'hide_if_empty' => __( '' )
266
+ ) );
267
+
268
+ $title = $instance['title'];
269
+ $hide_title = $instance['hide_title'];
270
+ $cat = $instance['cat'];
271
+ $num = $instance['num'];
272
+ $sort_by = $instance['sort_by'];
273
+ $asc_sort_order = $instance['asc_sort_order'];
274
+ $exclude_current_post = $instance['exclude_current_post'];
275
+ $title_link = $instance['title_link'];
276
+ $footer_link = $instance['footer_link'];
277
+ $excerpt = $instance['excerpt'];
278
+ $excerpt_length = $instance['excerpt_length'];
279
+ $comment_num = $instance['comment_num'];
280
+ $author = $instance['author'];
281
+ $date = $instance['date'];
282
+ $date_link = $instance['date_link'];
283
+ $date_format = $instance['date_format'];
284
+ $thumb = $instance['thumb'];
285
+ $thumbTop = $instance['thumbTop'];
286
+ $hideNoThumb = $instance['hideNoThumb'];
287
+ $thumb_w = $instance['thumb_w'];
288
+ $thumb_h = $instance['thumb_h'];
289
+ $disable_css = $instance['disable_css'];
290
+ $hide_if_empty = $instance['hide_if_empty'];
291
+
292
+ ?>
293
+ <p>
294
+ <label for="<?php echo $this->get_field_id("title"); ?>">
295
+ <?php _e( 'Title' ); ?>:
296
+ <input class="widefat" style="width:80%;" 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"]); ?>" />
297
+ </label>
298
+ </p>
299
+ <p>
300
+ <label for="<?php echo $this->get_field_id("title_link"); ?>">
301
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("title_link"); ?>" name="<?php echo $this->get_field_name("title_link"); ?>"<?php checked( (bool) $instance["title_link"], true ); ?> />
302
+ <?php _e( 'Make widget title link' ); ?>
303
+ </label>
304
+ </p>
305
+ <p>
306
+ <label for="<?php echo $this->get_field_id("hide_title"); ?>">
307
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("hide_title"); ?>" name="<?php echo $this->get_field_name("hide_title"); ?>"<?php checked( (bool) $instance["hide_title"], true ); ?> />
308
+ <?php _e( 'Hide title' ); ?>
309
+ </label>
310
+ </p>
311
+ <p>
312
+ <label>
313
+ <?php _e( 'Category' ); ?>:
314
+ <?php wp_dropdown_categories( array( 'hide_empty'=> 0, 'name' => $this->get_field_name("cat"), 'selected' => $instance["cat"] ) ); ?>
315
+ </label>
316
+ </p>
317
+ <p>
318
+ <label for="<?php echo $this->get_field_id("num"); ?>">
319
+ <?php _e('Number of posts to show'); ?>:
320
+ <input style="text-align: center;" id="<?php echo $this->get_field_id("num"); ?>" name="<?php echo $this->get_field_name("num"); ?>" type="text" value="<?php echo absint($instance["num"]); ?>" size='3' />
321
+ </label>
322
+ </p>
323
+ <p>
324
+ <label for="<?php echo $this->get_field_id("sort_by"); ?>">
325
+ <?php _e('Sort by'); ?>:
326
+ <select id="<?php echo $this->get_field_id("sort_by"); ?>" name="<?php echo $this->get_field_name("sort_by"); ?>">
327
+ <option value="date"<?php selected( $instance["sort_by"], "date" ); ?>>Date</option>
328
+ <option value="title"<?php selected( $instance["sort_by"], "title" ); ?>>Title</option>
329
+ <option value="comment_count"<?php selected( $instance["sort_by"], "comment_count" ); ?>>Number of comments</option>
330
+ <option value="rand"<?php selected( $instance["sort_by"], "rand" ); ?>>Random</option>
331
+ </select>
332
+ </label>
333
+ </p>
334
+ <p>
335
+ <label for="<?php echo $this->get_field_id("asc_sort_order"); ?>">
336
+ <input type="checkbox" class="checkbox"
337
+ id="<?php echo $this->get_field_id("asc_sort_order"); ?>"
338
+ name="<?php echo $this->get_field_name("asc_sort_order"); ?>"
339
+ <?php checked( (bool) $instance["asc_sort_order"], true ); ?> />
340
+ <?php _e( 'Reverse sort order (ascending)' ); ?>
341
+ </label>
342
+ </p>
343
+ <p>
344
+ <label for="<?php echo $this->get_field_id("exclude_current_post"); ?>">
345
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("exclude_current_post"); ?>" name="<?php echo $this->get_field_name("exclude_current_post"); ?>"<?php checked( (bool) $instance["exclude_current_post"], true ); ?> />
346
+ <?php _e( 'Exclude current post' ); ?>
347
+ </label>
348
+ </p>
349
+ <p>
350
+ <label for="<?php echo $this->get_field_id("date"); ?>">
351
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("date"); ?>" name="<?php echo $this->get_field_name("date"); ?>"<?php checked( (bool) $instance["date"], true ); ?> />
352
+ <?php _e( 'Show post date' ); ?>
353
+ </label>
354
+ </p>
355
+ <p>
356
+ <label for="<?php echo $this->get_field_id("date_format"); ?>">
357
+ <?php _e( 'Date format:' ); ?>
358
+ </label>
359
+ <input class="text" placeholder="j M Y" id="<?php echo $this->get_field_id("date_format"); ?>" name="<?php echo $this->get_field_name("date_format"); ?>" type="text" value="<?php echo esc_attr($instance["date_format"]); ?>" size="8" />
360
+ </p>
361
+ <p>
362
+ <label for="<?php echo $this->get_field_id("date_link"); ?>">
363
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("date_link"); ?>" name="<?php echo $this->get_field_name("date_link"); ?>"<?php checked( (bool) $instance["date_link"], true ); ?> />
364
+ <?php _e( 'Make widget date link' ); ?>
365
+ </label>
366
+ </p>
367
+ <p>
368
+ <label for="<?php echo $this->get_field_id("excerpt"); ?>">
369
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("excerpt"); ?>" name="<?php echo $this->get_field_name("excerpt"); ?>"<?php checked( (bool) $instance["excerpt"], true ); ?> />
370
+ <?php _e( 'Show post excerpt' ); ?>
371
+ </label>
372
+ </p>
373
+ <p>
374
+ <label for="<?php echo $this->get_field_id("excerpt_length"); ?>">
375
+ <?php _e( 'Excerpt length (in words):' ); ?>
376
+ </label>
377
+ <input style="text-align: center;" type="text" id="<?php echo $this->get_field_id("excerpt_length"); ?>" name="<?php echo $this->get_field_name("excerpt_length"); ?>" value="<?php echo $instance["excerpt_length"]; ?>" size="3" />
378
+ </p>
379
+ <?php if ( function_exists('the_post_thumbnail') && current_theme_supports("post-thumbnails") ) : ?>
380
+ <p>
381
+ <label for="<?php echo $this->get_field_id("thumb"); ?>">
382
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("thumb"); ?>" name="<?php echo $this->get_field_name("thumb"); ?>"<?php checked( (bool) $instance["thumb"], true ); ?> />
383
+ <?php _e( 'Show post thumbnail' ); ?>
384
+ </label>
385
+ </p>
386
+ <p>
387
+ <label for="<?php echo $this->get_field_id("thumbTop"); ?>">
388
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("thumbTop"); ?>" name="<?php echo $this->get_field_name("thumbTop"); ?>"<?php checked( (bool) $instance["thumbTop"], true ); ?> />
389
+ <?php _e( 'Thumbnail to top' ); ?>
390
+ </label>
391
+ </p>
392
+ <p>
393
+ <label>
394
+ <?php _e('Thumbnail dimensions (in pixels)'); ?>:<br />
395
+ <label for="<?php echo $this->get_field_id("thumb_w"); ?>">
396
+ Width: <input class="widefat" style="width:30%;" type="text" id="<?php echo $this->get_field_id("thumb_w"); ?>" name="<?php echo $this->get_field_name("thumb_w"); ?>" value="<?php echo $instance["thumb_w"]; ?>" />
397
+ </label>
398
+
399
+ <label for="<?php echo $this->get_field_id("thumb_h"); ?>">
400
+ Height: <input class="widefat" style="width:30%;" type="text" id="<?php echo $this->get_field_id("thumb_h"); ?>" name="<?php echo $this->get_field_name("thumb_h"); ?>" value="<?php echo $instance["thumb_h"]; ?>" />
401
+ </label>
402
+ </label>
403
+ </p>
404
+ <p>
405
+ <label for="<?php echo $this->get_field_id("hideNoThumb"); ?>">
406
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("hideNoThumb"); ?>" name="<?php echo $this->get_field_name("hideNoThumb"); ?>"<?php checked( (bool) $instance["hideNoThumb"], true ); ?> />
407
+ <?php _e( 'Hide posts which have no thumbnail' ); ?>
408
+ </label>
409
+ </p>
410
+ <?php endif; ?>
411
+ <p>
412
+ <label for="<?php echo $this->get_field_id("comment_num"); ?>">
413
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("comment_num"); ?>" name="<?php echo $this->get_field_name("comment_num"); ?>"<?php checked( (bool) $instance["comment_num"], true ); ?> />
414
+ <?php _e( 'Show number of comments' ); ?>
415
+ </label>
416
+ </p>
417
+ <p>
418
+ <label for="<?php echo $this->get_field_id("author"); ?>">
419
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("author"); ?>" name="<?php echo $this->get_field_name("author"); ?>"<?php checked( (bool) $instance["author"], true ); ?> />
420
+ <?php _e( 'Show post author' ); ?>
421
+ </label>
422
+ </p>
423
+ <p>
424
+ <label for="<?php echo $this->get_field_id("footer_link"); ?>">
425
+ <?php _e( 'Footer link text' ); ?>:
426
+ <input class="widefat" style="width:60%;" placeholder="... more by this topic" id="<?php echo $this->get_field_id("footer_link"); ?>" name="<?php echo $this->get_field_name("footer_link"); ?>" type="text" value="<?php echo esc_attr($instance["footer_link"]); ?>" />
427
+ </label>
428
+ </p>
429
+ <p>
430
+ <label for="<?php echo $this->get_field_id("disable_css"); ?>">
431
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("disable_css"); ?>" name="<?php echo $this->get_field_name("disable_css"); ?>"<?php checked( (bool) $instance["disable_css"], true ); ?> />
432
+ <?php _e( 'Disable widget CSS' ); ?>
433
+ </label>
434
+ </p>
435
+ <p>
436
+ <label for="<?php echo $this->get_field_id("hide_if_empty"); ?>">
437
+ <input type="checkbox" class="checkbox" id="<?php echo $this->get_field_id("hide_if_empty"); ?>" name="<?php echo $this->get_field_name("hide_if_empty"); ?>"<?php checked( (bool) $instance["hide_if_empty"], true ); ?> />
438
+ <?php _e( 'Hide if empty' ); ?>
439
+ </label>
440
+ </p>
441
+ <?php
442
+ }
443
+ }
444
+
445
+ add_action( 'widgets_init', create_function('', 'return register_widget("CategoryPosts");') );
readme.txt CHANGED
@@ -1,136 +1,155 @@
1
- === Category Posts Widget ===
2
- Contributors: mkrdip, kometschuh
3
- Donate link: http://mkrdip.me/donate
4
- Tags: category, posts, widget, single category widget, posts widget, category recent posts
5
- Requires at least: 2.8
6
- Tested up to: 4.3.1
7
- Stable tag: 4.1.3
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- Adds a widget that shows the most recent posts from a single category.
12
-
13
- == Description ==
14
-
15
- Category Posts Widget is a light widget designed to do one thing and do it well: display the most recent posts from a certain category.
16
-
17
- = Features =
18
-
19
- * Option to change ordering of posts.
20
- * Option to show post thumbnail & set dimension by width & height.
21
- * Option to put thumbnail on top
22
- * Option to disable widget CSS.
23
- * Set how many posts to show.
24
- * Set which category the posts should come form.
25
- * Option to show the post excerpt and how long the excerpt should be.
26
- * Option to show the post date.
27
- * Option to show the comment count.
28
- * Option to make the widget title link to the category page.
29
- * Option to hide the title.
30
- * Option to hide widget, if category have currently no posts.
31
- * Multiple widgets.
32
-
33
- = Contribute =
34
- While using this plugin if you find any bug or any conflict, please submit an issue at
35
- [Github](https://github.com/mkrdip/category-posts-widget) (If possible with a pull request).
36
-
37
- == Installation ==
38
-
39
- = Automatic installation =
40
-
41
- Automatic installation is the easiest option as WordPress handles the file transfers itself and you don’t need to leave your web browser. To do an automatic install of Category Posts Widget,
42
-
43
- 1. log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.
44
- 2. In the search field type “Category Posts Widget” and click Search Plugins.
45
- 3. Once you’ve found plugin, you can install it by simply clicking “Install Now”.
46
- 4. Then, go to plugins page of WordPress admin activate the plugin.
47
- 5. Now, goto the Widgets page of the Appearance section and configure the Category Posts widget.
48
-
49
- = Manual installation =
50
-
51
- 1. Download the plugin.
52
- 2. Upload it to the plugins folder of your blog.
53
- 3. Activate the plugin through the 'Plugins' menu in WordPress
54
- 4. Now, goto the Widgets page of the Appearance section and configure the Category Posts widget.
55
-
56
- == Upgrade Notice ==
57
-
58
- * Please consider to re-configure the widget as the latest version has numerous changes from previous.
59
- * Version 4.0 uses CSS file for styling the widget in front end.
60
- * Version 3.0 or later version uses WordPress 2.9's built in post thumbnail functionality.
61
-
62
- == Frequently Asked Questions ==
63
-
64
- = The font-size is different from that of other widgets? =
65
-
66
- Please use the option: "Disable widget CSS".
67
-
68
- = I want the title as a link pointing to the selected Categorie page? =
69
-
70
- Enable the check box "Make widget title link".
71
-
72
- == Screenshots ==
73
-
74
- 1. The widget configuration dialog.
75
- 2. Front end of the widget using a default WordPress Theme.
76
-
77
- == Changelog ==
78
-
79
- 4.1.3
80
-
81
- * Added option to hide widget, if category have currently no posts.
82
-
83
- 4.1.2
84
-
85
- * Fixed hide title bug.
86
-
87
- 4.1.1
88
-
89
- * Added option to put thumbnail on top.
90
- * Added option to show/hide the title.
91
- * Fixed no background bug.
92
-
93
- 4.1.0
94
-
95
- * Added PHP5 Constructor.
96
- * Added Option to allow/disallow widget CSS.
97
- * Now, compatible with WordPress 4.3.
98
- * Meet new plugin author [kometschuh](https://profiles.wordpress.org/kometschuh)
99
-
100
- 4.0
101
-
102
- * Added CSS file for post styling .
103
- * Now compatible with latest versions of WordPress.
104
-
105
- 3.3
106
-
107
- * Fixed random sort bug.
108
-
109
- 3.2
110
-
111
- * Added option to change ordering of posts. Defaults to showing newest posts first.
112
-
113
- 3.1
114
-
115
- * Fixed a bug in the thumbnail size registration routine.
116
-
117
- 3.0
118
-
119
- * Added support for WP 2.9's post thumbnail feature.
120
- * Removed support for Simple Post Thumbnails plugin.
121
- * Added option to show the post date.
122
- * Added option to set the excerpt length.
123
- * Added option to show the number of comments.
124
-
125
- 2.3
126
-
127
- * Really tried to fix bug where wp_query global was getting over written by manually instantiating a WP_Query object.
128
-
129
- 2.1
130
-
131
- * Fixed bug where wp_query global was getting over written.
132
-
133
- 2.0
134
-
135
- * Updated to use the WP 2.8 widget API.
136
- * Added support for [Simple Post Thumbnails plugin](http://wordpress.org/extend/plugins/simple-post-thumbnails/).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ === Category Posts Widget ===
2
+ Contributors: mkrdip, kometschuh
3
+ Donate link: http://mkrdip.me/donate
4
+ Tags: category, posts, widget, single category widget, posts widget, category recent posts
5
+ Requires at least: 2.8
6
+ Tested up to: 4.4
7
+ Stable tag: 4.1.4
8
+ License: GPLv2 or later
9
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
+
11
+ Adds a widget that shows the most recent posts from a single category.
12
+
13
+ == Description ==
14
+
15
+ Category Posts Widget is a light widget designed to do one thing and do it well: display the most recent posts from a certain category.
16
+
17
+ = Features =
18
+
19
+ * Option to change ordering of posts.
20
+ * Option to show post thumbnail & set dimension by width & height.
21
+ * Option to put thumbnail on top
22
+ * Option to hide posts which have no thumbnail.
23
+ * Option to disable widget CSS.
24
+ * Set how many posts to show.
25
+ * Option exclude current post.
26
+ * Option show post author.
27
+ * Set which category the posts should come form.
28
+ * Option to show the post excerpt and how long the excerpt should be.
29
+ * Option to show the post date.
30
+ * Option to make the widget date link to the category page.
31
+ * Option to format the outputted date string.
32
+ * Option to show the comment count.
33
+ * Option to make the widget title link to the category page.
34
+ * Option to link to the category page below posts list.
35
+ * Option to hide the title.
36
+ * Option to hide widget, if category have currently no posts.
37
+ * Multiple widgets.
38
+
39
+ = Documentation =
40
+
41
+ Formatting date and time: See <a target="_blank" href="https://codex.wordpress.org/Formatting_Date_and_Time">Formatting Date and Time</a>.
42
+
43
+ = Contribute =
44
+ While using this plugin if you find any bug or any conflict, please submit an issue at
45
+ [Github](https://github.com/mkrdip/category-posts-widget) (If possible with a pull request).
46
+
47
+ == Installation ==
48
+
49
+ = Automatic installation =
50
+
51
+ Automatic installation is the easiest option as WordPress handles the file transfers itself and you don’t need to leave your web browser. To do an automatic install of Category Posts Widget,
52
+
53
+ 1. log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.
54
+ 2. In the search field type “Category Posts Widget” and click Search Plugins.
55
+ 3. Once you’ve found plugin, you can install it by simply clicking “Install Now”.
56
+ 4. Then, go to plugins page of WordPress admin activate the plugin.
57
+ 5. Now, goto the Widgets page of the Appearance section and configure the Category Posts widget.
58
+
59
+ = Manual installation =
60
+
61
+ 1. Download the plugin.
62
+ 2. Upload it to the plugins folder of your blog.
63
+ 3. Activate the plugin through the 'Plugins' menu in WordPress
64
+ 4. Now, goto the Widgets page of the Appearance section and configure the Category Posts widget.
65
+
66
+ == Upgrade Notice ==
67
+
68
+ * Please consider to re-configure the widget as the latest version has numerous changes from previous.
69
+ * Version 4.0 uses CSS file for styling the widget in front end.
70
+ * Version 3.0 or later version uses WordPress 2.9's built in post thumbnail functionality.
71
+
72
+ == Frequently Asked Questions ==
73
+
74
+ = The font-size is different from that of other widgets? =
75
+
76
+ Please use the option: "Disable widget CSS".
77
+
78
+ = I want the title as a link pointing to the selected Categorie page? =
79
+
80
+ Enable the check box "Make widget title link".
81
+
82
+ == Screenshots ==
83
+
84
+ 1. The widget configuration dialog.
85
+ 2. Front end of the widget using a default WordPress Theme.
86
+
87
+ == Changelog ==
88
+
89
+ 4.1.4
90
+
91
+ * Added option exclude current post.
92
+ * Added option to hide posts which have no thumbnail.
93
+ * Added option to make the widget date link to the category page.
94
+ * Added option to link to the category page below posts list.
95
+ * Added option show post author.
96
+ * Added option to format the outputted date string.
97
+
98
+ 4.1.3
99
+
100
+ * Added option to hide widget, if category have currently no posts.
101
+
102
+ 4.1.2
103
+
104
+ * Fixed hide title bug.
105
+
106
+ 4.1.1
107
+
108
+ * Added option to put thumbnail on top.
109
+ * Added option to show/hide the title.
110
+ * Fixed no background bug.
111
+
112
+ 4.1.0
113
+
114
+ * Added PHP5 Constructor.
115
+ * Added Option to allow/disallow widget CSS.
116
+ * Now, compatible with WordPress 4.3.
117
+ * Meet new plugin author [kometschuh](https://profiles.wordpress.org/kometschuh)
118
+
119
+ 4.0
120
+
121
+ * Added CSS file for post styling .
122
+ * Now compatible with latest versions of WordPress.
123
+
124
+ 3.3
125
+
126
+ * Fixed random sort bug.
127
+
128
+ 3.2
129
+
130
+ * Added option to change ordering of posts. Defaults to showing newest posts first.
131
+
132
+ 3.1
133
+
134
+ * Fixed a bug in the thumbnail size registration routine.
135
+
136
+ 3.0
137
+
138
+ * Added support for WP 2.9's post thumbnail feature.
139
+ * Removed support for Simple Post Thumbnails plugin.
140
+ * Added option to show the post date.
141
+ * Added option to set the excerpt length.
142
+ * Added option to show the number of comments.
143
+
144
+ 2.3
145
+
146
+ * Really tried to fix bug where wp_query global was getting over written by manually instantiating a WP_Query object.
147
+
148
+ 2.1
149
+
150
+ * Fixed bug where wp_query global was getting over written.
151
+
152
+ 2.0
153
+
154
+ * Updated to use the WP 2.8 widget API.
155
+ * Added support for [Simple Post Thumbnails plugin](http://wordpress.org/extend/plugins/simple-post-thumbnails/).