List category posts - Version 0.30.2

Version Description

  • Improves 'current category' detection.
    • Adds categorypage parameter to widget
Download this release

Release Info

Developer fernandobt
Plugin Icon 128x128 List category posts
Version 0.30.2
Comparing to
See all releases

Code changes from version 0.30.1 to 0.30.2

include/CatList.php CHANGED
@@ -132,8 +132,8 @@ class CatList{
132
 
133
  private function get_lcp_category(){
134
  if ( $this->lcp_not_empty('categorypage') &&
135
- $this->params['categorypage'] == 'yes' ):
136
-
137
  $this->lcp_category_id = $this->lcp_get_current_category();
138
  elseif ( $this->lcp_not_empty('name') ):
139
  if (preg_match('/\+/', $this->params['name'])):
@@ -170,8 +170,8 @@ class CatList{
170
 
171
  public function lcp_get_current_category(){
172
  global $post;
173
- $categories = get_the_category($post->ID);
174
- return $categories[0]->cat_ID;
175
  }
176
 
177
  /**
132
 
133
  private function get_lcp_category(){
134
  if ( $this->lcp_not_empty('categorypage') &&
135
+ $this->params['categorypage'] == 'yes' ||
136
+ $this->params['id'] == -1):
137
  $this->lcp_category_id = $this->lcp_get_current_category();
138
  elseif ( $this->lcp_not_empty('name') ):
139
  if (preg_match('/\+/', $this->params['name'])):
170
 
171
  public function lcp_get_current_category(){
172
  global $post;
173
+ $category = get_category( get_query_var( 'cat' ) );
174
+ return $category->cat_ID;
175
  }
176
 
177
  /**
include/lcp_widget_form.php CHANGED
@@ -59,6 +59,13 @@
59
  <select id="<?php echo $this->get_field_id('categoryid'); ?>" name="<?php echo $this->get_field_name('categoryid'); ?>">
60
  <?php
61
  $categories= get_categories();
 
 
 
 
 
 
 
62
  foreach ($categories as $cat) :
63
  $option = '<option value="' . $cat->cat_ID . '" ';
64
  if ($cat->cat_ID == $categoryid) :
@@ -155,7 +162,7 @@
155
  <p>
156
  <label><?php _e("Show", 'list-category-posts')?>: </label><br/>
157
  <input type="checkbox" <?php checked( (bool) $instance['thumbnail'], true ); ?>
158
- name="<?php echo $this->get_field_name( 'thumbnail'); ?>" /> <?php _e("Thumbnail - size", 'list-category-posts')?>
159
  <select id="<?php echo $this->get_field_id('thumbnail_size'); ?>"
160
  name="<?php echo $this->get_field_name( 'thumbnail_size' ); ?>" type="text">
161
  <option value='thumbnail'>thumbnail</option>
59
  <select id="<?php echo $this->get_field_id('categoryid'); ?>" name="<?php echo $this->get_field_name('categoryid'); ?>">
60
  <?php
61
  $categories= get_categories();
62
+ $option = '<option value="-1"';
63
+ if ($categoryid == -1) :
64
+ $option .= ' selected = "selected" ';
65
+ endif;
66
+ $option .= '">' . "Current category" . '</option>';
67
+ echo $option;
68
+
69
  foreach ($categories as $cat) :
70
  $option = '<option value="' . $cat->cat_ID . '" ';
71
  if ($cat->cat_ID == $categoryid) :
162
  <p>
163
  <label><?php _e("Show", 'list-category-posts')?>: </label><br/>
164
  <input type="checkbox" <?php checked( (bool) $instance['thumbnail'], true ); ?>
165
+ name="<?php echo $this->get_field_name( 'thumbnail'); ?>" /> <?php _e("Thumbnail - size", 'list-category-posts')?>
166
  <select id="<?php echo $this->get_field_id('thumbnail_size'); ?>"
167
  name="<?php echo $this->get_field_name( 'thumbnail_size' ); ?>" type="text">
168
  <option value='thumbnail'>thumbnail</option>
list_cat_posts.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: List category posts
4
  Plugin URI: https://github.com/picandocodigo/List-Category-Posts
5
  Description: List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode. This shortcode accepts a category name or id, the order in which you want the posts to display, and the number of posts to display. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
- Version: 0.30.1
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
3
  Plugin Name: List category posts
4
  Plugin URI: https://github.com/picandocodigo/List-Category-Posts
5
  Description: List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode. This shortcode accepts a category name or id, the order in which you want the posts to display, and the number of posts to display. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
+ Version: 0.30.2
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate Link: http://picandocodigo.net/programacion/wordpress/list-category-posts
4
  Tags: list, categories, posts, cms
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
- Stable tag: 0.30.1
8
 
9
  == Description ==
10
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode. When you're editing a page or post, directly insert the shortcode in your text and the posts will be listed there. The **basic** usage would be something like this:
@@ -28,7 +28,7 @@ Please, read the information on [Other Notes](http://wordpress.org/extend/plugin
28
 
29
  **Support the plugin**
30
 
31
- If you've found the plugin useful, consider making a [donation via PayPal](http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/ "Donate via PayPal") or visit my Amazon Wishlist for [books](http://www.amazon.com/gp/registry/wishlist/2HU1JYOF7DX5Q/ref=wl_web "Amazon Wishlist") or [comic books](http://www.amazon.com/registry/wishlist/1LVYAOJAZQOI0/ref=cm_wl_rlist_go_o) :).
32
 
33
  **Development**
34
 
@@ -139,7 +139,7 @@ When using List Category Posts whithout a category id, name or slug, it will pos
139
  * **private** - not visible to users who are not logged in.
140
  * **inherit** - a revision. see get_children.
141
  * **trash** - post is in trashbin (available with Version 2.9).
142
- * **any** - retrieves any status except those from post types with 'exclude_from_search' set to true.
143
 
144
 
145
  * **post_parent** - Show only the children of the post with this ID. Default: None.
@@ -161,7 +161,7 @@ When using List Category Posts whithout a category id, name or slug, it will pos
161
  You can customize what HTML tags different elements will be sorrounded with and a CSS class for this element. The customizable elements are: author, catlink (category link), comments, date, excerpt, morelink ("Read More" link), thumbnail and title (post title).
162
 
163
  The parameters are:
164
- `autor_tag, author_class, catlink_tag, catlink_class, comments_tag, comments_class, date_tag, date_class,
165
  excerpt_tag, excerpt_class, morelink_class, thumbnail_class, title_tag, title_class, posts_morelink_class`
166
 
167
  So for example, let's say you want to wrap the displayed comments count with the p tag and a "lcp_comments" class, you would do:
@@ -245,7 +245,11 @@ Template system has changed. Custom templates should be stored in WordPress them
245
 
246
  == Changelog ==
247
 
248
- = 0.31 =
 
 
 
 
249
  * **excerpt** - Fixed default excerpt behaviour from previous release. By default it **will** strip html tags as it always did. If you want it not to strip tags, you'll have to use `excerpt_strip=no`. Added a new parameter to have a consistent excerpt. If you want to overwrite WordPress' excerpt when using the plugin and generate one the way the plugin does when there's no excerpt, use `excerpt_overwrite=yes`.
250
 
251
  = 0.30 =
@@ -339,7 +343,7 @@ This update is dedicated to [Michelle K McGinnis](http://friendlywebconsulting.c
339
 
340
  = 0.21.1 =
341
 
342
- * Small fixes:
343
  * Used "empty()" function for some Strings instead of evaluating isset() and != ''.
344
  * Include parameters on the get_posts args only when they are set (post_parent among others).
345
 
@@ -389,7 +393,7 @@ This update is dedicated to [Michelle K McGinnis](http://friendlywebconsulting.c
389
  = 0.19 =
390
 
391
  This update is dedicated to S. Keller from Switzerland who gave me "The Ultimate Hitchhiker's Guide to the Galaxy" from my Amazon Wishlit in appreciation for the plugin. I am really enjoying the read :D. If you, like S would like to show your appreciation, here's my [wishlist](http://www.amazon.com/gp/registry/wishlist/2HU1JYOF7DX5Q/ref=wl_web):
392
-
393
  * Fixed private post logic, not displaying post if private. Thanks Bainternet from WordPress Answers: http://wordpress.stackexchange.com/questions/12514/list-category-posts-not-showing-posts-marked-private-to-logged-in-users/12520#12520
394
  * Added thumbnail_size parameter.
395
  * Added support for custom taxonomies and also moved to the array call of get_posts. Coded by wsherliker, thanks! http://picod.net/32
@@ -444,7 +448,7 @@ This update is dedicated to S. Keller from Switzerland who gave me "The Ultimate
444
 
445
  = 0.14.1 =
446
 
447
- * Fixed "Show the title of the category with a link to the category" code (catlink param), it broke on some previous update, but now it's working again. Thanks Soccerwidow on the WP Forums for pointing this out.
448
 
449
  = 0.14 =
450
 
@@ -454,11 +458,11 @@ This update is dedicated to S. Keller from Switzerland who gave me "The Ultimate
454
 
455
  = 0.13.2 =
456
 
457
- * Fixed thumbnail code, added it to default.php template as example.
458
 
459
  = 0.13.1 =
460
 
461
- * Fixed broken dateformat.
462
 
463
  = 0.13 =
464
 
@@ -484,7 +488,7 @@ This update is dedicated to S. Keller from Switzerland who gave me "The Ultimate
484
 
485
 
486
  = 0.10.1 =
487
- * Small fix -
488
  added ul tags to default template.
489
  * Compatible WordPress 3.0 with Twenty Ten theme (thanks again Doug Joseph :) )
490
 
4
  Tags: list, categories, posts, cms
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
+ Stable tag: 0.30.2
8
 
9
  == Description ==
10
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode. When you're editing a page or post, directly insert the shortcode in your text and the posts will be listed there. The **basic** usage would be something like this:
28
 
29
  **Support the plugin**
30
 
31
+ If you've found the plugin useful, consider making a [donation via PayPal](http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/ "Donate via PayPal") or visit my Amazon Wishlist for [books](http://www.amazon.com/gp/registry/wishlist/2HU1JYOF7DX5Q/ref=wl_web "Amazon Wishlist") or [comic books](http://www.amazon.com/registry/wishlist/1LVYAOJAZQOI0/ref=cm_wl_rlist_go_o) :).
32
 
33
  **Development**
34
 
139
  * **private** - not visible to users who are not logged in.
140
  * **inherit** - a revision. see get_children.
141
  * **trash** - post is in trashbin (available with Version 2.9).
142
+ * **any** - retrieves any status except those from post types with 'exclude_from_search' set to true.
143
 
144
 
145
  * **post_parent** - Show only the children of the post with this ID. Default: None.
161
  You can customize what HTML tags different elements will be sorrounded with and a CSS class for this element. The customizable elements are: author, catlink (category link), comments, date, excerpt, morelink ("Read More" link), thumbnail and title (post title).
162
 
163
  The parameters are:
164
+ `autor_tag, author_class, catlink_tag, catlink_class, comments_tag, comments_class, date_tag, date_class,
165
  excerpt_tag, excerpt_class, morelink_class, thumbnail_class, title_tag, title_class, posts_morelink_class`
166
 
167
  So for example, let's say you want to wrap the displayed comments count with the p tag and a "lcp_comments" class, you would do:
245
 
246
  == Changelog ==
247
 
248
+ = 0.30.2 =
249
+ * Improves 'current category' detection.
250
+ * Adds categorypage parameter to widget
251
+
252
+ = 0.30.1 =
253
  * **excerpt** - Fixed default excerpt behaviour from previous release. By default it **will** strip html tags as it always did. If you want it not to strip tags, you'll have to use `excerpt_strip=no`. Added a new parameter to have a consistent excerpt. If you want to overwrite WordPress' excerpt when using the plugin and generate one the way the plugin does when there's no excerpt, use `excerpt_overwrite=yes`.
254
 
255
  = 0.30 =
343
 
344
  = 0.21.1 =
345
 
346
+ * Small fixes:
347
  * Used "empty()" function for some Strings instead of evaluating isset() and != ''.
348
  * Include parameters on the get_posts args only when they are set (post_parent among others).
349
 
393
  = 0.19 =
394
 
395
  This update is dedicated to S. Keller from Switzerland who gave me "The Ultimate Hitchhiker's Guide to the Galaxy" from my Amazon Wishlit in appreciation for the plugin. I am really enjoying the read :D. If you, like S would like to show your appreciation, here's my [wishlist](http://www.amazon.com/gp/registry/wishlist/2HU1JYOF7DX5Q/ref=wl_web):
396
+
397
  * Fixed private post logic, not displaying post if private. Thanks Bainternet from WordPress Answers: http://wordpress.stackexchange.com/questions/12514/list-category-posts-not-showing-posts-marked-private-to-logged-in-users/12520#12520
398
  * Added thumbnail_size parameter.
399
  * Added support for custom taxonomies and also moved to the array call of get_posts. Coded by wsherliker, thanks! http://picod.net/32
448
 
449
  = 0.14.1 =
450
 
451
+ * Fixed "Show the title of the category with a link to the category" code (catlink param), it broke on some previous update, but now it's working again. Thanks Soccerwidow on the WP Forums for pointing this out.
452
 
453
  = 0.14 =
454
 
458
 
459
  = 0.13.2 =
460
 
461
+ * Fixed thumbnail code, added it to default.php template as example.
462
 
463
  = 0.13.1 =
464
 
465
+ * Fixed broken dateformat.
466
 
467
  = 0.13 =
468
 
488
 
489
 
490
  = 0.10.1 =
491
+ * Small fix -
492
  added ul tags to default template.
493
  * Compatible WordPress 3.0 with Twenty Ten theme (thanks again Doug Joseph :) )
494