List category posts - Version 0.20.4

Version Description

  • Yet another bugfix, regarding nothing being displayed when using tags.
Download this release

Release Info

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

Code changes from version 0.20.3 to 0.20.4

Files changed (3) hide show
  1. include/CatList.php +8 -6
  2. list_cat_posts.php +1 -1
  3. readme.txt +7 -4
include/CatList.php CHANGED
@@ -24,6 +24,7 @@ class CatList{
24
  * Get the categories & posts
25
  */
26
  private function lcp_set_categories(){
 
27
  if ( isset($this->params['categorypage']) && $this->params['categorypage'] == 'yes' ){
28
  global $post;
29
  $categories = get_the_category($post->ID);
@@ -32,11 +33,11 @@ class CatList{
32
  $this->lcp_category_id = $this->get_category_id_by_name($this->params['name']);
33
  } elseif ( isset($this->params['id']) && $this->params['id'] != '0' ){
34
  $this->lcp_category_id = $this->params['id'];
35
- } else {
36
- $this->lcp_category_id = 0;
37
  }
38
-
39
- $args = array('cat'=> $this->lcp_category_id);
 
 
40
 
41
  $args = array_merge($args, array(
42
  'numberposts' => $this->params['numberposts'],
@@ -62,13 +63,13 @@ class CatList{
62
  }
63
 
64
  // Added custom taxonomy support
65
- if (isset($this->params['taxonomy']) && $this->params['tags'] != "") {
66
  $args['tax_query'] = array(array(
67
  'taxonomy' => $this->params['taxonomy'],
68
  'field' => 'slug',
69
  'terms' => explode(",",$this->params['tags'])
70
  ));
71
- } elseif (isset($this->params['tags'])) {
72
  $args['tag'] = $this->params['tags'];
73
  }
74
 
@@ -80,6 +81,7 @@ class CatList{
80
  * by Eric Celeste / http://eric.clst.org
81
  */
82
  private function get_category_id_by_name($cat_name){
 
83
  //We check if the name gets the category id, if not, we check the slug.
84
  $term = get_term_by('slug', $cat_name, 'category');
85
  if (!$term):
24
  * Get the categories & posts
25
  */
26
  private function lcp_set_categories(){
27
+ $args = array();
28
  if ( isset($this->params['categorypage']) && $this->params['categorypage'] == 'yes' ){
29
  global $post;
30
  $categories = get_the_category($post->ID);
33
  $this->lcp_category_id = $this->get_category_id_by_name($this->params['name']);
34
  } elseif ( isset($this->params['id']) && $this->params['id'] != '0' ){
35
  $this->lcp_category_id = $this->params['id'];
 
 
36
  }
37
+
38
+ if ($this->lcp_category_id != 0){
39
+ $args['category'] = $this->lcp_category_id;
40
+ }
41
 
42
  $args = array_merge($args, array(
43
  'numberposts' => $this->params['numberposts'],
63
  }
64
 
65
  // Added custom taxonomy support
66
+ if (isset($this->params['taxonomy']) && $this->params['taxonomy'] != '' && $this->params['tags'] != "") {
67
  $args['tax_query'] = array(array(
68
  'taxonomy' => $this->params['taxonomy'],
69
  'field' => 'slug',
70
  'terms' => explode(",",$this->params['tags'])
71
  ));
72
+ } else if (isset($this->params['tags'])) {
73
  $args['tag'] = $this->params['tags'];
74
  }
75
 
81
  * by Eric Celeste / http://eric.clst.org
82
  */
83
  private function get_category_id_by_name($cat_name){
84
+ #TODO: Support multiple names (this used to work, but not anymore)
85
  //We check if the name gets the category id, if not, we check the slug.
86
  $term = get_term_by('slug', $cat_name, 'category');
87
  if (!$term):
list_cat_posts.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: List category posts
4
  Plugin URI: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
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.20.3
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
  */
3
  Plugin Name: List category posts
4
  Plugin URI: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
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.20.4
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: 2.8
6
  Tested up to: 3.2.1
7
- Stable tag: 0.20.3
8
 
9
  == Description ==
10
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode.
@@ -44,12 +44,12 @@ If you've found the plugin useful, consider making a [donation via PayPal](http:
44
 
45
  *Selecting the category*
46
 
47
- The plugin can figure out the category from which you want to list posts in three different ways: Using the *category id*, the *category slug* and *detecting the current post's category*.
48
- When using List Category Posts inside a post, if you don't pass the category id or slug, it will post the latest posts from every category.
49
  You can use the *categorypage* parameter to make it detect the category id of the current posts, and list posts from that category.
50
  The parameters for choosing the category id are:
51
 
52
- * **name** - To display posts from a category using the category's name. Ex: [catlist name=mycategory]
53
 
54
  * **id** - To display posts from a category using the category's id. Ex: [catlist id=24]. You can **include several categories**: Ex: [catlist id=17,24,32] or **exclude** a category with the minus (-)
55
 
@@ -166,6 +166,9 @@ Template system has changed. Custom templates should be stored in WordPress them
166
 
167
  == Changelog ==
168
 
 
 
 
169
  = 0.20.3 =
170
  * Fixed category detection code, which created some messy bugs in some cases
171
 
4
  Tags: list, categories, posts, cms
5
  Requires at least: 2.8
6
  Tested up to: 3.2.1
7
+ Stable tag: 0.20.4
8
 
9
  == Description ==
10
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode.
44
 
45
  *Selecting the category*
46
 
47
+ The plugin can figure out the category from which you want to list posts in three different ways: Using the *category id*, the *category name or slug* and *detecting the current post's category*.
48
+ When using List Category Posts inside a post, if you don't pass the category id, name or slug, it will post the latest posts from every category.
49
  You can use the *categorypage* parameter to make it detect the category id of the current posts, and list posts from that category.
50
  The parameters for choosing the category id are:
51
 
52
+ * **name** - To display posts from a category using the category's name or slug. Ex: [catlist name=mycategory]
53
 
54
  * **id** - To display posts from a category using the category's id. Ex: [catlist id=24]. You can **include several categories**: Ex: [catlist id=17,24,32] or **exclude** a category with the minus (-)
55
 
166
 
167
  == Changelog ==
168
 
169
+ = 0.20.4 =
170
+ * Yet another bugfix, regarding nothing being displayed when using tags.
171
+
172
  = 0.20.3 =
173
  * Fixed category detection code, which created some messy bugs in some cases
174