List category posts - Version 0.43.1

Version Description

  • Show "no posts text" only if it's been set and there are no posts, otherwise behave like before.
Download this release

Release Info

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

Code changes from version 0.43 to 0.43.1

Files changed (3) hide show
  1. include/CatListDisplayer.php +13 -13
  2. list_cat_posts.php +2 -2
  3. readme.txt +8 -2
include/CatListDisplayer.php CHANGED
@@ -84,22 +84,22 @@ class CatListDisplayer {
84
  $this->lcp_output .= '>';
85
  $inner_tag = ($tag == 'ul') ? 'li' : 'p';
86
 
87
-
88
-
89
  //Posts loop
90
- if ($this->catlist->get_posts_count() > 0) {
91
- foreach ($this->catlist->get_categories_posts() as $single) :
92
- if ( !post_password_required($single) ||
93
- ( post_password_required($single) && (
94
- isset($this->params['show_protected']) &&
95
- $this->params['show_protected'] == 'yes' ) )):
96
- $this->lcp_output .= $this->lcp_build_post($single, $inner_tag);
97
- endif;
98
- endforeach;
99
- } else {
100
- $this->lcp_output = $this->params["no_posts_text"];
 
101
  }
102
 
 
103
  //Close wrapper tag
104
  $this->lcp_output .= '</' . $tag . '>';
105
 
84
  $this->lcp_output .= '>';
85
  $inner_tag = ($tag == 'ul') ? 'li' : 'p';
86
 
 
 
87
  //Posts loop
88
+ foreach ($this->catlist->get_categories_posts() as $single) :
89
+ if ( !post_password_required($single) ||
90
+ ( post_password_required($single) && (
91
+ isset($this->params['show_protected']) &&
92
+ $this->params['show_protected'] == 'yes' ) )):
93
+ $this->lcp_output .= $this->lcp_build_post($single, $inner_tag);
94
+ endif;
95
+ endforeach;
96
+
97
+ if ( ($this->catlist->get_posts_count() == 0) &&
98
+ ($this->params["no_posts_text"] != '') ) {
99
+ $this->lcp_output .= $this->params["no_posts_text"];
100
  }
101
 
102
+
103
  //Close wrapper tag
104
  $this->lcp_output .= '</' . $tag . '>';
105
 
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.43
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
@@ -109,7 +109,7 @@ class ListCategoryPosts{
109
  'pagination' => 'no',
110
  'pagination_next' => '>>',
111
  'pagination_prev' => '<<',
112
- 'no_posts_text' => "No posts found",
113
  'instance' => '0'
114
  ), $atts);
115
  if( $atts['numberposts'] == ''){
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.43.1
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
109
  'pagination' => 'no',
110
  'pagination_next' => '>>',
111
  'pagination_prev' => '<<',
112
+ 'no_posts_text' => "",
113
  'instance' => '0'
114
  ), $atts);
115
  if( $atts['numberposts'] == ''){
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.8.1
7
- Stable tag: 0.43
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -158,7 +158,9 @@ update the plugin.
158
  You can set the default number of posts globally on the options
159
  page on your Dashboard in Settings / List Category Posts.
160
 
161
- * **no_posts_text** - Text to display when no posts are found.
 
 
162
 
163
  * **monthnum** and **year** - List posts from a certain year or month. You can use these together or independently. Example: `[catlist year=2015]` will list posts from the year 2015. `[catlist monthnum=8]` will list posts published in August of every year. `[catlist year=2012 monthnum=12]` will list posts from December 2012.
164
 
@@ -395,6 +397,10 @@ Template system has changed. Custom templates should be stored in WordPress them
395
 
396
  == Changelog ==
397
 
 
 
 
 
398
  = 0.43 =
399
  * Removes filters to order by (should fix issues with order)
400
  * Adds `pagination_prev` and `pagination_next` params to customize
4
  Tags: list, categories, posts, cms
5
  Requires at least: 3.3
6
  Tested up to: 3.8.1
7
+ Stable tag: 0.43.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
158
  You can set the default number of posts globally on the options
159
  page on your Dashboard in Settings / List Category Posts.
160
 
161
+ * **no_posts_text** - Text to display when no posts are found. If you
162
+ don't specify it, nothing will get displayed where the posts
163
+ should be.
164
 
165
  * **monthnum** and **year** - List posts from a certain year or month. You can use these together or independently. Example: `[catlist year=2015]` will list posts from the year 2015. `[catlist monthnum=8]` will list posts published in August of every year. `[catlist year=2012 monthnum=12]` will list posts from December 2012.
166
 
397
 
398
  == Changelog ==
399
 
400
+ = 0.43.1 =
401
+ * Show "no posts text" only if it's been set and there are no posts,
402
+ otherwise behave like before.
403
+
404
  = 0.43 =
405
  * Removes filters to order by (should fix issues with order)
406
  * Adds `pagination_prev` and `pagination_next` params to customize