Category Posts Widget - Version 4.1.5

Version Description

  • February 4 2016 =
  • Support for multi sites.
  • Support for localization.
  • Generate thumbs from existing images.
  • Area UI.
  • Meet new plugin author mark-k
Download this release

Release Info

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

Code changes from version 4.1.4 to 4.1.5

Files changed (4) hide show
  1. cat-posts.css +46 -46
  2. cat-posts.php +310 -209
  3. js/admin/category-posts-widget.js +24 -0
  4. readme.txt +34 -41
cat-posts.css CHANGED
@@ -1,46 +1,46 @@
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 {
28
- float: left;
29
- margin: 5px 10px 5px 0;
30
- }
31
- .cat-post-item {
32
- border-bottom: 1px solid #ccc;
33
- list-style: none;
34
- list-style-type: none;
35
- margin: 3px 0;
36
- padding: 3px 0;
37
- }
38
- .cat-post-item:before,
39
- .cat-post-item:after {
40
- content: "";
41
- display: table;
42
- clear: both;
43
- }
44
- .cat-post-item:last-child {
45
- border-bottom: none;
46
- }
1
+ /*
2
+ Default CSS Styles for the Category Posts Widget plugin
3
+ Version: 4.1.5
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 {
28
+ float: left;
29
+ margin: 5px 10px 5px 0;
30
+ }
31
+ .cat-post-item {
32
+ border-bottom: 1px solid #ccc;
33
+ list-style: none;
34
+ list-style-type: none;
35
+ margin: 3px 0;
36
+ padding: 3px 0;
37
+ }
38
+ .cat-post-item:before,
39
+ .cat-post-item:after {
40
+ content: "";
41
+ display: table;
42
+ clear: both;
43
+ }
44
+ .cat-post-item:last-child {
45
+ border-bottom: none;
46
+ }
cat-posts.php CHANGED
@@ -4,13 +4,47 @@ 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
  *
@@ -19,27 +53,89 @@ if ( !defined( 'ABSPATH' ) ) exit;
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
@@ -49,19 +145,15 @@ add_action( 'init', 'category_posts_add_image_size' );
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"]);
@@ -138,13 +230,12 @@ class CategoryPosts extends WP_Widget {
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; ?>
@@ -163,13 +254,12 @@ class CategoryPosts extends WP_Widget {
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;
@@ -196,9 +286,9 @@ class CategoryPosts extends WP_Widget {
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
 
@@ -206,8 +296,7 @@ class CategoryPosts extends WP_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
@@ -220,15 +309,7 @@ class CategoryPosts extends WP_Widget {
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
 
@@ -240,29 +321,29 @@ class CategoryPosts extends WP_Widget {
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'];
@@ -290,156 +371,176 @@ class CategoryPosts extends WP_Widget {
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");') );
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.5
8
  Author URI: http://mkrdip.me
9
  */
10
 
11
  // Don't call the file directly
12
  if ( !defined( 'ABSPATH' ) ) exit;
13
 
14
+ /*
15
+ Check if CSS needs to be enqueued by traversing all active widgets on the page
16
+ and checking if they all have disabled CSS.
17
+
18
+ Return: false if CSS should not be enqueued, true if it should
19
+ */
20
+ function category_posts_should_enqueue($id_base,$class) {
21
+ global $wp_registered_widgets;
22
+ $ret = false;
23
+ $sidebars_widgets = wp_get_sidebars_widgets();
24
+
25
+ if ( is_array($sidebars_widgets) ) {
26
+ foreach ( $sidebars_widgets as $sidebar => $widgets ) {
27
+ if ( 'wp_inactive_widgets' === $sidebar || 'orphaned_widgets' === substr( $sidebar, 0, 16 ) ) {
28
+ continue;
29
+ }
30
+
31
+ if ( is_array($widgets) ) {
32
+ foreach ( $widgets as $widget ) {
33
+ $widget_base = _get_widget_id_base($widget);
34
+ if ( $widget_base == $id_base ) {
35
+ $widgetclass = new $class();
36
+ $allsettings = $widgetclass->get_settings();
37
+ $settings = $allsettings[str_replace($widget_base.'-','',$widget)];
38
+ if (!isset($settings['disable_css'])) // checks if css disable is not set
39
+ $ret = true;
40
+ }
41
+ }
42
+ }
43
+ }
44
+ }
45
+ return $ret;
46
+ }
47
+
48
  /**
49
  * Register our styles
50
  *
53
  add_action( 'wp_enqueue_scripts', 'category_posts_widget_styles' );
54
 
55
  function category_posts_widget_styles() {
56
+ $enqueue = category_posts_should_enqueue('category-posts','CategoryPosts');
57
+ if ($enqueue) {
58
+ wp_register_style( 'category-posts', plugins_url( 'category-posts/cat-posts.css' ) );
59
+ wp_enqueue_style( 'category-posts' );
60
+ }
61
  }
62
 
63
  /**
64
+ * Load plugin textdomain.
65
  *
 
66
  */
67
+ add_action( 'admin_init', 'category_posts_load_textdomain' );
68
+
69
+ function category_posts_load_textdomain() {
70
+ load_plugin_textdomain( 'categoryposts', false, plugin_basename( dirname( __FILE__ ) ) . '/languages' );
 
 
 
 
71
  }
72
 
73
+ /**
74
+ * Add styles for widget sections
75
+ *
76
+ */
77
+ add_action( 'admin_print_styles-widgets.php', 'category_posts_admin_styles' );
78
+
79
+ function category_posts_admin_styles() {
80
+ ?>
81
+ <style>
82
+ .category-widget-cont h4 {
83
+ padding: 12px 15px;
84
+ cursor: pointer;
85
+ margin: 5px 0;
86
+ border: 1px solid #E5E5E5;
87
+ }
88
+ .category-widget-cont h4:first-child {
89
+ margin-top: 10px;
90
+ }
91
+ .category-widget-cont h4:last-of-type {
92
+ margin-bottom: 10px;
93
+ }
94
+ .category-widget-cont h4:after {
95
+ float:right;
96
+ font-family: "dashicons";
97
+ content: '\f140';
98
+ -ms-transform: translate(-1px,1px);
99
+ -webkit-transform: translate(-1px,1px);
100
+ -moz-transform: translate(-1px,1px);
101
+ transform: translate(-1px,1px);
102
+ -ms-transition: all 600ms;
103
+ -webkit-transition: all 600ms;
104
+ -moz-transition: all 600ms;
105
+ transition: all 600ms;
106
+ }
107
+ .category-widget-cont h4.open:after {
108
+ -ms-transition: all 600ms;
109
+ -webkit-transition: all 600ms;
110
+ -moz-transition: all 600ms;
111
+ transition: all 600ms;
112
+ -ms-transform: rotate(180deg);
113
+ -webkit-transform: rotate(180deg);
114
+ -moz-transform: rotate(180deg);
115
+ transform: rotate(180deg);
116
+ }
117
+ .category-widget-cont div {
118
+ display:none;
119
+ overflow: hidden;
120
+ }
121
+ .category-widget-cont div.open {
122
+ display:block;
123
+ }
124
+ </style>
125
+ <?php
126
+ }
127
 
128
+ /**
129
+ * Add JS to control open and close the widget section
130
+ *
131
+ */
132
+ add_action( 'admin_enqueue_scripts', 'category_posts_admin_scripts', 100 );
133
+
134
+ function category_posts_admin_scripts() {
135
+ // widget script
136
+ wp_register_script( 'category-posts-admin-js', plugins_url( 'category-posts/js/admin/category-posts-widget.js' ),array('jquery'),'4.1.2',true );
137
+ wp_enqueue_script( 'category-posts-admin-js' );
138
+ }
139
 
140
  /**
141
  * Category Posts Widget Class
145
  class CategoryPosts extends WP_Widget {
146
 
147
  function __construct() {
148
+ $widget_ops = array('classname' => 'cat-post-widget', 'description' => __('List single category posts','categoryposts'));
149
+ parent::__construct('category-posts', __('Category Posts','categoryposts'), $widget_ops);
150
  }
151
 
152
  // Displays category posts widget on blog.
153
  function widget($args, $instance) {
 
 
154
 
155
  extract( $args );
156
 
 
 
157
  // If not title, use the name of the category.
158
  if( !$instance["title"] ) {
159
  $category_info = get_category($instance["cat"]);
230
 
231
  <?php
232
  if( isset( $instance["thumbTop"] ) ) :
233
+ if ( current_theme_supports("post-thumbnails") &&
 
234
  isset( $instance["thumb"] ) &&
235
  has_post_thumbnail() ) : ?>
236
  <a <?php if( !isset( $instance['disable_css'] ) ) { echo "class=\"cat-post-thumbnail\""; } ?>
237
  href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
238
+ <?php the_post_thumbnail( array($instance['thumb_w'],$instance['thumb_h'])); ?>
239
  </a>
240
  <?php endif;
241
  endif; ?>
254
  <?php endif;
255
 
256
  if( !isset( $instance["thumbTop"] ) ) :
257
+ if ( current_theme_supports("post-thumbnails") &&
 
258
  isset( $instance["thumb"] ) &&
259
  has_post_thumbnail() ) : ?>
260
  <a <?php if( !isset( $instance['disable_css'] ) ) { echo "class=\"cat-post-thumbnail\""; } ?>
261
  href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
262
+ <?php the_post_thumbnail( array($instance['thumb_w'],$instance['thumb_h'])); ?>
263
  </a>
264
  <?php endif;
265
  endif;
286
  echo "</ul>\n";
287
 
288
  // Footer link to category page
289
+ if( isset ( $instance["footer_link"] ) && $instance["footer_link"] ) {
290
  echo "<a";
291
+ if( !isset( $instance['disable_css'] ) ) { echo " class=\"cat-post-footer-link\""; }
292
  echo " href=\"" . get_category_link($instance["cat"]) . "\">" . $instance["footer_link"] . "</a>";
293
  }
294
 
296
 
297
  remove_filter('excerpt_length', $new_excerpt_length);
298
 
299
+ wp_reset_postdata();
 
300
 
301
  } // END if
302
  } // END function
309
  * @return array
310
  */
311
  function update($new_instance, $old_instance) {
312
+
 
 
 
 
 
 
 
 
313
  return $new_instance;
314
  }
315
 
321
  */
322
  function form($instance) {
323
  $instance = wp_parse_args( ( array ) $instance, array(
324
+ 'title' => '',
325
+ 'hide_title' => '',
326
+ 'cat' => '',
327
+ 'num' => '',
328
+ 'sort_by' => '',
329
+ 'asc_sort_order' => '',
330
+ 'exclude_current_post' => '',
331
+ 'title_link' => '',
332
+ 'footer_link' => '',
333
+ 'excerpt' => '',
334
+ 'excerpt_length' => '',
335
+ 'comment_num' => '',
336
+ 'author' => '',
337
+ 'date' => '',
338
+ 'date_link' => '',
339
+ 'date_format' => '',
340
+ 'thumb' => '',
341
+ 'thumbTop' => '',
342
+ 'hideNoThumb' => '',
343
+ 'thumb_w' => '',
344
+ 'thumb_h' => '',
345
+ 'disable_css' => '',
346
+ 'hide_if_empty' => ''
347
  ) );
348
 
349
  $title = $instance['title'];
371
  $hide_if_empty = $instance['hide_if_empty'];
372
 
373
  ?>
374
+ <div class="category-widget-cont">
375
+ <h4 class="open"><?php _e('Filter','categoryposts');?></h4>
376
+ <div class="open">
377
+ <p>
378
+ <label>
379
+ <?php _e( 'Category','categoryposts' ); ?>:
380
+ <?php wp_dropdown_categories( array( 'hide_empty'=> 0, 'name' => $this->get_field_name("cat"), 'selected' => $instance["cat"] ) ); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
381
  </label>
382
+ </p>
383
+ <p>
384
+ <label for="<?php echo $this->get_field_id("num"); ?>">
385
+ <?php _e('Number of posts to show','categoryposts'); ?>:
386
+ <input style="text-align: center; width: 30%;" id="<?php echo $this->get_field_id("num"); ?>" name="<?php echo $this->get_field_name("num"); ?>" type="number" min="0" value="<?php echo absint($instance["num"]); ?>" />
387
+ </label>
388
+ </p>
389
+ <p>
390
+ <label for="<?php echo $this->get_field_id("sort_by"); ?>">
391
+ <?php _e('Sort by','categoryposts'); ?>:
392
+ <select id="<?php echo $this->get_field_id("sort_by"); ?>" name="<?php echo $this->get_field_name("sort_by"); ?>">
393
+ <option value="date"<?php selected( $instance["sort_by"], "date" ); ?>><?php _e('Date','categoryposts')?></option>
394
+ <option value="title"<?php selected( $instance["sort_by"], "title" ); ?>><?php _e('Title','categoryposts')?></option>
395
+ <option value="comment_count"<?php selected( $instance["sort_by"], "comment_count" ); ?>><?php _e('Number of comments','categoryposts')?></option>
396
+ <option value="rand"<?php selected( $instance["sort_by"], "rand" ); ?>><?php _e('Random','categoryposts')?></option>
397
+ </select>
398
+ </label>
399
+ </p>
400
+ <p>
401
+ <label for="<?php echo $this->get_field_id("asc_sort_order"); ?>">
402
+ <input type="checkbox" class="checkbox"
403
+ id="<?php echo $this->get_field_id("asc_sort_order"); ?>"
404
+ name="<?php echo $this->get_field_name("asc_sort_order"); ?>"
405
+ <?php checked( (bool) $instance["asc_sort_order"], true ); ?> />
406
+ <?php _e( 'Reverse sort order (ascending)','categoryposts' ); ?>
407
+ </label>
408
+ </p>
409
+ <p>
410
+ <label for="<?php echo $this->get_field_id("exclude_current_post"); ?>">
411
+ <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 ); ?> />
412
+ <?php _e( 'Exclude current post','categoryposts' ); ?>
413
+ </label>
414
+ </p>
415
+ </div>
416
+ <h4><?php _e('Title','categoryposts')?></h4>
417
+ <div>
418
+ <p>
419
+ <label for="<?php echo $this->get_field_id("title"); ?>">
420
+ <?php _e( 'Title','categoryposts' ); ?>:
421
+ <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"]); ?>" />
422
+ </label>
423
+ </p>
424
+ <p>
425
+ <label for="<?php echo $this->get_field_id("title_link"); ?>">
426
+ <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 ); ?> />
427
+ <?php _e( 'Make widget title link','categoryposts' ); ?>
428
+ </label>
429
+ </p>
430
+ <p>
431
+ <label for="<?php echo $this->get_field_id("hide_title"); ?>">
432
+ <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 ); ?> />
433
+ <?php _e( 'Hide title','categoryposts' ); ?>
434
+ </label>
435
+ </p>
436
+ </div>
437
+ <?php if ( current_theme_supports("post-thumbnails") ) : ?>
438
+ <h4><?php _e('Thumbnails','categoryposts')?></h4>
439
+ <div>
440
+ <p>
441
+ <label for="<?php echo $this->get_field_id("thumb"); ?>">
442
+ <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 ); ?> />
443
+ <?php _e( 'Show post thumbnail','categoryposts' ); ?>
444
+ </label>
445
+ </p>
446
+ <p>
447
+ <label for="<?php echo $this->get_field_id("hideNoThumb"); ?>">
448
+ <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 ); ?> />
449
+ <?php _e( 'Hide posts which have no thumbnail','categoryposts' ); ?>
450
+ </label>
451
+ </p>
452
+ <p>
453
+ <label for="<?php echo $this->get_field_id("thumbTop"); ?>">
454
+ <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 ); ?> />
455
+ <?php _e( 'Thumbnail to top','categoryposts' ); ?>
456
+ </label>
457
+ </p>
458
+ <p>
459
+ <label>
460
+ <?php _e('Thumbnail dimensions (in pixels)','categoryposts'); ?>:<br />
461
+ <label for="<?php echo $this->get_field_id("thumb_w"); ?>">
462
+ <?php _e('Width:','categoryposts')?> <input class="widefat" style="width:30%;" type="number" min="1" id="<?php echo $this->get_field_id("thumb_w"); ?>" name="<?php echo $this->get_field_name("thumb_w"); ?>" value="<?php echo $instance["thumb_w"]; ?>" />
463
+ </label>
464
+
465
+ <label for="<?php echo $this->get_field_id("thumb_h"); ?>">
466
+ <?php _e('Height:','categoryposts')?> <input class="widefat" style="width:30%;" type="number" min="1" id="<?php echo $this->get_field_id("thumb_h"); ?>" name="<?php echo $this->get_field_name("thumb_h"); ?>" value="<?php echo $instance["thumb_h"]; ?>" />
467
+ </label>
468
+ </label>
469
+ </p>
470
+ </div>
471
+ <?php endif; ?>
472
+ <h4><?php _e('Post details','categoryposts')?></h4>
473
+ <div>
474
+ <p>
475
+ <label for="<?php echo $this->get_field_id("excerpt"); ?>">
476
+ <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 ); ?> />
477
+ <?php _e( 'Show post excerpt','categoryposts' ); ?>
478
+ </label>
479
+ </p>
480
+ <p>
481
+ <label for="<?php echo $this->get_field_id("excerpt_length"); ?>">
482
+ <?php _e( 'Excerpt length (in words):','categoryposts' ); ?>
483
+ </label>
484
+ <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" />
485
+ </p>
486
+ <p>
487
+ <label for="<?php echo $this->get_field_id("date"); ?>">
488
+ <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 ); ?> />
489
+ <?php _e( 'Show post date','categoryposts' ); ?>
490
+ </label>
491
+ </p>
492
+ <p>
493
+ <label for="<?php echo $this->get_field_id("date_format"); ?>">
494
+ <?php _e( 'Date format:','categoryposts' ); ?>
495
+ </label>
496
+ <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" />
497
+ </p>
498
+ <p>
499
+ <label for="<?php echo $this->get_field_id("date_link"); ?>">
500
+ <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 ); ?> />
501
+ <?php _e( 'Make widget date link','categoryposts' ); ?>
502
+ </label>
503
+ </p>
504
+ <p>
505
+ <label for="<?php echo $this->get_field_id("comment_num"); ?>">
506
+ <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 ); ?> />
507
+ <?php _e( 'Show number of comments','categoryposts' ); ?>
508
+ </label>
509
+ </p>
510
+ <p>
511
+ <label for="<?php echo $this->get_field_id("author"); ?>">
512
+ <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 ); ?> />
513
+ <?php _e( 'Show post author','categoryposts' ); ?>
514
+ </label>
515
+ </p>
516
+ </div>
517
+ <h4><?php _e('Footer','categoryposts')?></h4>
518
+ <div>
519
+ <p>
520
+ <label for="<?php echo $this->get_field_id("footer_link"); ?>">
521
+ <?php _e( 'Footer link text','categoryposts' ); ?>:
522
+ <input class="widefat" style="width:60%;" placeholder="<?php _e('... more by this topic','categoryposts')?>" 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"]); ?>" />
523
+ </label>
524
+ </p>
525
+ </div>
526
+ <h4><?php _e('General styling','categoryposts')?></h4>
527
+ <div>
528
+ <p>
529
+ <label for="<?php echo $this->get_field_id("disable_css"); ?>">
530
+ <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 ); ?> />
531
+ <?php _e( 'Disable widget CSS','categoryposts' ); ?>
532
+ </label>
533
+ </p>
534
+ <p>
535
+ <label for="<?php echo $this->get_field_id("hide_if_empty"); ?>">
536
+ <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 ); ?> />
537
+ <?php _e( 'Hide if empty','categoryposts' ); ?>
538
  </label>
539
+ </p>
540
+ </div>
541
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
542
  <?php
543
  }
544
  }
545
 
546
+ add_action( 'widgets_init', create_function('', 'return register_widget("CategoryPosts");') );
js/admin/category-posts-widget.js ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /**
2
+ * Category Posts Widget
3
+ * http://mkrdip.me/category-posts-widget
4
+ *
5
+ * Adds a widget that shows the most recent posts from a single category.
6
+ *
7
+ * Released under the GPLv2 license or later - http://www.gnu.org/licenses/gpl-2.0.html
8
+ */
9
+
10
+ if (window.jQuery) {
11
+
12
+ jQuery('.category-widget-cont h4').click(function () { // for widgets page
13
+ jQuery(this).toggleClass('open')
14
+ .next().slideToggle('open');
15
+ })
16
+
17
+
18
+ jQuery(document).on('widget-added widget-updated', function(){ // for customize and after save on widgets page
19
+ jQuery('.category-widget-cont h4').click(function () {
20
+ jQuery(this).toggleClass('open')
21
+ .next().slideToggle('open');
22
+ })
23
+ });
24
+ }
readme.txt CHANGED
@@ -1,21 +1,27 @@
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
@@ -35,9 +41,11 @@ Category Posts Widget is a light widget designed to do one thing and do it well:
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 =
@@ -45,9 +53,7 @@ While using this plugin if you find any bug or any conflict, please submit an is
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.
@@ -57,37 +63,36 @@ Automatic installation is the easiest option as WordPress handles the file trans
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.
@@ -95,61 +100,49 @@ Enable the check box "Make widget title link".
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/).
1
  === Category Posts Widget ===
2
+ Contributors: mkrdip, mark-k, 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.1
7
+ Stable tag: 4.1.5
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
  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.
15
 
16
+ = Term and Category based Posts Widget =
17
+ It's the pro version and available at on <a target="_blank" href="http://tiptoppress.com/">Tip Top Press</a> created for big Wordpress sites.
18
+ We giving you a 50%-special discount code: **'WordPress'**. (Enter it after checkout.)
19
+ = Pro features =
20
+ * Custom Post Types, Terms and Custom Taxonomies
21
+ * Multi selection
22
+ * Different styles, like vertical scrolling ticker
23
 
24
+ = Features =
25
  * Option to change ordering of posts.
26
  * Option to show post thumbnail & set dimension by width & height.
27
  * Option to put thumbnail on top
41
  * Option to hide the title.
42
  * Option to hide widget, if category have currently no posts.
43
  * Multiple widgets.
44
+ * Multi sites support.
45
+ * Localization support.
46
+ * Generate thumbs from existing images.
47
 
48
  = Documentation =
 
49
  Formatting date and time: See <a target="_blank" href="https://codex.wordpress.org/Formatting_Date_and_Time">Formatting Date and Time</a>.
50
 
51
  = Contribute =
53
  [Github](https://github.com/mkrdip/category-posts-widget) (If possible with a pull request).
54
 
55
  == Installation ==
 
56
  = Automatic installation =
 
57
  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,
58
 
59
  1. log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.
63
  5. Now, goto the Widgets page of the Appearance section and configure the Category Posts widget.
64
 
65
  = Manual installation =
 
66
  1. Download the plugin.
67
  2. Upload it to the plugins folder of your blog.
68
  3. Activate the plugin through the 'Plugins' menu in WordPress
69
  4. Now, goto the Widgets page of the Appearance section and configure the Category Posts widget.
70
 
71
  == Upgrade Notice ==
 
72
  * Please consider to re-configure the widget as the latest version has numerous changes from previous.
73
  * Version 4.0 uses CSS file for styling the widget in front end.
74
  * Version 3.0 or later version uses WordPress 2.9's built in post thumbnail functionality.
75
 
76
  == Frequently Asked Questions ==
 
77
  = The font-size is different from that of other widgets? =
 
78
  Please use the option: "Disable widget CSS".
79
 
80
  = I want the title as a link pointing to the selected Categorie page? =
 
81
  Enable the check box "Make widget title link".
82
 
83
  == Screenshots ==
 
84
  1. The widget configuration dialog.
85
  2. Front end of the widget using a default WordPress Theme.
86
 
87
  == Changelog ==
88
+ = 4.1.5 - February 4 2016 =
89
+ * Support for multi sites.
90
+ * Support for localization.
91
+ * Generate thumbs from existing images.
92
+ * Area UI.
93
+ * Meet new plugin author [mark-k](https://profiles.wordpress.org/mark-k/)
94
+
95
+ = 4.1.4 =
96
  * Added option exclude current post.
97
  * Added option to hide posts which have no thumbnail.
98
  * Added option to make the widget date link to the category page.
100
  * Added option show post author.
101
  * Added option to format the outputted date string.
102
 
103
+ = 4.1.3 =
 
104
  * Added option to hide widget, if category have currently no posts.
105
 
106
+ = 4.1.2 =
 
107
  * Fixed hide title bug.
108
 
109
+ = 4.1.1 =
 
110
  * Added option to put thumbnail on top.
111
  * Added option to show/hide the title.
112
  * Fixed no background bug.
113
 
114
+ = 4.1.0 =
 
115
  * Added PHP5 Constructor.
116
  * Added Option to allow/disallow widget CSS.
117
  * Now, compatible with WordPress 4.3.
118
  * Meet new plugin author [kometschuh](https://profiles.wordpress.org/kometschuh)
119
 
120
+ = 4.0 =
 
121
  * Added CSS file for post styling .
122
  * Now compatible with latest versions of WordPress.
123
 
124
+ = 3.3 =
 
125
  * Fixed random sort bug.
126
 
127
+ = 3.2 =
 
128
  * Added option to change ordering of posts. Defaults to showing newest posts first.
129
 
130
+ = 3.1 =
 
131
  * Fixed a bug in the thumbnail size registration routine.
132
 
133
+ = 3.0 =
 
134
  * Added support for WP 2.9's post thumbnail feature.
135
  * Removed support for Simple Post Thumbnails plugin.
136
  * Added option to show the post date.
137
  * Added option to set the excerpt length.
138
  * Added option to show the number of comments.
139
 
140
+ = 2.3 =
 
141
  * Really tried to fix bug where wp_query global was getting over written by manually instantiating a WP_Query object.
142
 
143
+ = 2.1 =
 
144
  * Fixed bug where wp_query global was getting over written.
145
 
146
+ = 2.0 =
 
147
  * Updated to use the WP 2.8 widget API.
148
  * Added support for [Simple Post Thumbnails plugin](http://wordpress.org/extend/plugins/simple-post-thumbnails/).