List category posts - Version 0.44

Version Description

  • Adds the feature to get an author's posts
    • Adds show posts from current post's tags.
Download this release

Release Info

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

Code changes from version 0.43.1 to 0.44

Files changed (3) hide show
  1. include/CatList.php +16 -0
  2. list_cat_posts.php +3 -1
  3. readme.txt +10 -1
include/CatList.php CHANGED
@@ -90,6 +90,9 @@ class CatList{
90
  $args['s'] = $this->params['search'];
91
  endif;
92
 
 
 
 
93
 
94
  /*
95
  * Custom fields 'customfield_name' & 'customfield_value'
@@ -118,6 +121,10 @@ class CatList{
118
  $args['tag__not_in'] = $tag_ids;
119
  endif;
120
 
 
 
 
 
121
  // Added custom taxonomy support
122
  if ( $this->lcp_not_empty('taxonomy') && $this->lcp_not_empty('tags') ):
123
  $args['tax_query'] = array(array(
@@ -228,6 +235,15 @@ class CatList{
228
  return $category->cat_ID;
229
  }
230
 
 
 
 
 
 
 
 
 
 
231
  /**
232
  * Get the category id from its name
233
  * by Eric Celeste / http://eric.clst.org
90
  $args['s'] = $this->params['search'];
91
  endif;
92
 
93
+ if($this->lcp_not_empty('author_posts')):
94
+ $args['author_name'] = $this->params['author_posts'];
95
+ endif;
96
 
97
  /*
98
  * Custom fields 'customfield_name' & 'customfield_value'
121
  $args['tag__not_in'] = $tag_ids;
122
  endif;
123
 
124
+ if ( $this->lcp_not_empty('currenttags') && $this->params['currenttags'] == "yes" ):
125
+ $args['tag__in'] = $this->lcp_get_current_tags();
126
+ endif;
127
+
128
  // Added custom taxonomy support
129
  if ( $this->lcp_not_empty('taxonomy') && $this->lcp_not_empty('tags') ):
130
  $args['tax_query'] = array(array(
235
  return $category->cat_ID;
236
  }
237
 
238
+ public function lcp_get_current_tags(){
239
+ $tags = get_the_tags();
240
+ $tag_ids = array();
241
+ foreach ($tags as $tag_id => $tag) {
242
+ array_push($tag_ids, $tag_id);
243
+ }
244
+ return $tag_ids;
245
+ }
246
+
247
  /**
248
  * Get the category id from its name
249
  * by Eric Celeste / http://eric.clst.org
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.1
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
@@ -54,6 +54,7 @@ class ListCategoryPosts{
54
  'author' => 'no',
55
  'author_tag' =>'',
56
  'author_class' => '',
 
57
  'template' => 'default',
58
  'excerpt' => 'no',
59
  'excerpt_size' => '55',
@@ -66,6 +67,7 @@ class ListCategoryPosts{
66
  'offset' => '0',
67
  'tags' => '',
68
  'exclude_tags' => '',
 
69
  'content' => 'no',
70
  'content_tag' => '',
71
  'content_class' => '',
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.44
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
54
  'author' => 'no',
55
  'author_tag' =>'',
56
  'author_class' => '',
57
+ 'author_posts' => '',
58
  'template' => 'default',
59
  'excerpt' => 'no',
60
  'excerpt_size' => '55',
67
  'offset' => '0',
68
  'tags' => '',
69
  'exclude_tags' => '',
70
+ 'currenttags' => '',
71
  'content' => 'no',
72
  'content_tag' => '',
73
  'content_class' => '',
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.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -125,8 +125,13 @@ update the plugin.
125
 
126
  ==Other parameters==
127
 
 
 
 
128
  * **tags** - Tag support, you can display posts from a certain tag.
129
 
 
 
130
  * **exclude_tags** - Exclude posts from one or more tags: `[catlist tags="videogames" exclude_tags="sega,sony"]`
131
 
132
  * **orderby** - To customize the order. Valid values are:
@@ -397,6 +402,10 @@ Template system has changed. Custom templates should be stored in WordPress them
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.
4
  Tags: list, categories, posts, cms
5
  Requires at least: 3.3
6
  Tested up to: 3.8.1
7
+ Stable tag: 0.44
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
125
 
126
  ==Other parameters==
127
 
128
+ * **author_posts** - Get posts by author. Use 'user_nicename' (NOT
129
+ name). Example: `[catlist author_posts="fernando"]`
130
+
131
  * **tags** - Tag support, you can display posts from a certain tag.
132
 
133
+ * **currenttags* - Display posts from the current post's tags.
134
+
135
  * **exclude_tags** - Exclude posts from one or more tags: `[catlist tags="videogames" exclude_tags="sega,sony"]`
136
 
137
  * **orderby** - To customize the order. Valid values are:
402
 
403
  == Changelog ==
404
 
405
+ = 0.44 =
406
+ * Adds the feature to get an author's posts
407
+ * Adds show posts from current post's tags.
408
+
409
  = 0.43.1 =
410
  * Show "no posts text" only if it's been set and there are no posts,
411
  otherwise behave like before.