List category posts - Version 0.42.0

Version Description

= 0.37 =

When using content=yes, if the post has a more tag, the plugin will only show the content previous to the more tag and not all the content as it used before (it now supports the more tag the same way as WordPress).

= 0.34 = * Now the plugin accepts either class or tag or both for styling elements (such as date, author, etc. to display). When just using a tag, it will sorround the element with that tag. When using just a class, it will sorround the element between span tags and the given CSS class. Check Other notes under HTML & CSS Customization for more info. * Fixed bug on post_status, it used to show all published posts and if user was logged in, all private ones too. Now you can specify 'private' to just display private posts, and draft, publish, draft, etc (See post_status param on the instructions for more info).

= 0.25 = * Translation support.

= 0.18 = Template system was upgraded with new options. Backwards compatible, but you can better customize the way the post contents are displayed. Check templates/default.php.

= 0.17 = Upgrade your templates: Templates system was rewritten, so your current templates will probably not work. Check out the new default.php file on /templates to see the simpler new way to work with templates.

= 0.13.2 = Thumbnail parameter 'thumbnails' changed to 'thumbnail.

= 0.7.2 = Template system has changed. Now the posts loop must be defined inside the template. Check templates/default.php for an example.

= 0.8 = Widget built for WordPress 2.8's Widget API, so you need at least WP 2.8 to use the widget.

= 0.9 = Template system has changed. Custom templates should be stored in WordPress theme folder.

Download this release

Release Info

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

Code changes from version 0.41.2 to 0.42.0

include/CatList.php CHANGED
@@ -51,10 +51,13 @@ class CatList{
51
  $exclude = array(
52
  'post__not_in' => explode(",", $this->params['excludeposts'])
53
  );
54
- if (strpos($args['exclude'], 'this') !== FALSE) :
55
  $exclude = array_merge(
56
  $exclude,
57
- array('post__not_in' => $this->lcp_get_current_post_id())
 
 
 
58
  );
59
  endif;
60
  $args = array_merge($args, $exclude);
@@ -312,22 +315,18 @@ class CatList{
312
  $custom_fields = get_post_custom($post_id);
313
 
314
  //Loop on custom fields and if there's a value, add it:
315
- foreach ($custom_array as $something) :
316
- $my_custom_field = $custom_fields[$something];
317
-
318
- if (sizeof($my_custom_field) > 0 ):
319
-
320
- foreach ( $my_custom_field as $key => $value ) :
321
- $lcp_customs .= "<div class=\"lcp-customfield\">";
322
-
323
- if ($this->params['customfield_display_name'] != "no")
324
- $lcp_customs .= $something . " : ";
325
-
326
- $lcp_customs .= $value . "</div>";
327
- endforeach;
328
-
329
  endif;
330
-
331
  endforeach;
332
 
333
  return $lcp_customs;
51
  $exclude = array(
52
  'post__not_in' => explode(",", $this->params['excludeposts'])
53
  );
54
+ if (strpos($this->params['excludeposts'], 'this') > -1) :
55
  $exclude = array_merge(
56
  $exclude,
57
+ array('post__not_in' => array(
58
+ $this->lcp_get_current_post_id()
59
+ )
60
+ )
61
  );
62
  endif;
63
  $args = array_merge($args, $exclude);
315
  $custom_fields = get_post_custom($post_id);
316
 
317
  //Loop on custom fields and if there's a value, add it:
318
+ foreach ($custom_array as $user_customfield) :
319
+ if(isset($custom_fields[$user_customfield])):
320
+ $my_custom_field = $custom_fields[$user_customfield];
321
+
322
+ if (sizeof($my_custom_field) > 0 ):
323
+ foreach ( $my_custom_field as $key => $value ) :
324
+ if ($this->params['customfield_display_name'] != "no")
325
+ $lcp_customs .= $user_customfield . " : ";
326
+ $lcp_customs .= $value;
327
+ endforeach;
328
+ endif;
 
 
 
329
  endif;
 
330
  endforeach;
331
 
332
  return $lcp_customs;
include/CatListDisplayer.php CHANGED
@@ -88,7 +88,8 @@ class CatListDisplayer {
88
 
89
  //Posts loop
90
  foreach ($this->catlist->get_categories_posts() as $single) :
91
- if ( !post_password_required($single) ) :
 
92
  $this->lcp_output .= $this->lcp_build_post($single, $inner_tag);
93
  endif;
94
  endforeach;
@@ -218,10 +219,27 @@ class CatListDisplayer {
218
  endif;
219
 
220
 
 
221
  if (!empty($this->params['customfield_display'])) :
222
- $lcp_display_output .=
223
- $this->get_custom_fields($this->params['customfield_display'],
224
- $single->ID);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
225
  endif;
226
 
227
  $lcp_display_output .= $this->get_thumbnail($single);
@@ -284,6 +302,10 @@ class CatListDisplayer {
284
 
285
  private function get_custom_fields($custom_key, $post_id, $tag = null, $css_class = null){
286
  $info = $this->catlist->get_custom_fields($custom_key, $post_id);
 
 
 
 
287
  return $this->assign_style($info, $tag, $css_class);
288
  }
289
 
88
 
89
  //Posts loop
90
  foreach ($this->catlist->get_categories_posts() as $single) :
91
+ if ( !post_password_required($single) ||
92
+ ( post_password_required($single) && $this->params['show_protected'] == 'yes' ) ):
93
  $this->lcp_output .= $this->lcp_build_post($single, $inner_tag);
94
  endif;
95
  endforeach;
219
  endif;
220
 
221
 
222
+ // Custom field display
223
  if (!empty($this->params['customfield_display'])) :
224
+ if (!empty($this->params['customfield_tag'])):
225
+ if (!empty($this->params['customfield_class'])):
226
+ $lcp_display_output .= $this->get_custom_fields(
227
+ $this->params['customfield_display'],
228
+ $single->ID,
229
+ $this->params['customfield_tag'],
230
+ $this->params['customfield_class']);
231
+ else:
232
+ $lcp_display_output .= $this->get_custom_fields(
233
+ $this->params['customfield_display'],
234
+ $single->ID,
235
+ $this->params['customfield_tag']);
236
+ endif;
237
+ else:
238
+ $lcp_display_output .= $this->get_custom_fields(
239
+ $this->params['customfield_display'],
240
+ $single->ID
241
+ );
242
+ endif;
243
  endif;
244
 
245
  $lcp_display_output .= $this->get_thumbnail($single);
302
 
303
  private function get_custom_fields($custom_key, $post_id, $tag = null, $css_class = null){
304
  $info = $this->catlist->get_custom_fields($custom_key, $post_id);
305
+ if($tag == null)
306
+ $tag = 'div';
307
+ if($css_class == null)
308
+ $css_class = 'lcp_customfield';
309
  return $this->assign_style($info, $tag, $css_class);
310
  }
311
 
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.41.2
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
@@ -85,12 +85,15 @@ class ListCategoryPosts{
85
  'post_status' => '',
86
  'post_parent' => '0',
87
  'post_suffix' => '',
 
88
  'class' => 'lcp_catlist',
89
  'customfield_name' => '',
90
  'customfield_value' =>'',
91
  'customfield_display' =>'',
92
  'customfield_display_name' =>'',
93
  'customfield_orderby' =>'',
 
 
94
  'taxonomy' => '',
95
  'categorypage' => '',
96
  'category_count' => '',
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.42.0
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
85
  'post_status' => '',
86
  'post_parent' => '0',
87
  'post_suffix' => '',
88
+ 'show_protected' => 'no',
89
  'class' => 'lcp_catlist',
90
  'customfield_name' => '',
91
  'customfield_value' =>'',
92
  'customfield_display' =>'',
93
  'customfield_display_name' =>'',
94
  'customfield_orderby' =>'',
95
+ 'customfield_tag' => '',
96
+ 'customfield_class' => '',
97
  'taxonomy' => '',
98
  'categorypage' => '',
99
  'category_count' => '',
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
7
- Stable tag: 0.41.2
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -197,6 +197,8 @@ update the plugin.
197
  * **trash** - post is in trashbin (available with Version 2.9).
198
  * **any** - retrieves any status except those from post types with 'exclude_from_search' set to true.
199
 
 
 
200
 
201
  * **post_parent** - Show only the children of the post with this ID.
202
  Default: None.
@@ -219,7 +221,12 @@ update the plugin.
219
  * **customfield_display** - Display custom field(s). You can specify
220
  many fields to show, separating them with a coma. If you want to
221
  display just the value and not the name of the custom field, use
222
- `customfield_display_name` and set it to no:
 
 
 
 
 
223
 
224
  * **customfield_display_name** - To use with `customfield_display`.
225
  Use it to just print the value of the Custom field and not the
@@ -244,8 +251,10 @@ You can customize what HTML tags different elements will be sorrounded with and
244
  The customizable elements (so far) are: author, catlink (category link), comments, date, excerpt, morelink ("Read More" link), thumbnail and title (post title).
245
 
246
  The parameters are:
247
- `autor_tag, author_class, catlink_tag, catlink_class, comments_tag, comments_class, date_tag, date_class,
248
- excerpt_tag, excerpt_class, morelink_class, thumbnail_class, title_tag, title_class, posts_morelink_class`
 
 
249
 
250
  So let's say you want to wrap the displayed comments count with the p tag and a "lcp_comments" class, you would do:
251
  `[catlist id=7 comments=yes comments_tag=p comments_class=lcp_comments]`
@@ -376,6 +385,11 @@ Template system has changed. Custom templates should be stored in WordPress them
376
 
377
  == Changelog ==
378
 
 
 
 
 
 
379
  = 0.41.2 =
380
  * Small bugfix with customfield_display_name (wasn't working now it
381
  is)
4
  Tags: list, categories, posts, cms
5
  Requires at least: 3.3
6
  Tested up to: 3.8
7
+ Stable tag: 0.42.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
197
  * **trash** - post is in trashbin (available with Version 2.9).
198
  * **any** - retrieves any status except those from post types with 'exclude_from_search' set to true.
199
 
200
+ * **show_protected** - Show posts protected by password. By default
201
+ they are not displayed. Use: `[catlist show_protected=yes]`
202
 
203
  * **post_parent** - Show only the children of the post with this ID.
204
  Default: None.
221
  * **customfield_display** - Display custom field(s). You can specify
222
  many fields to show, separating them with a coma. If you want to
223
  display just the value and not the name of the custom field, use
224
+ `customfield_display_name` and set it to no.
225
+ By default, the custom fields will show inside a div with a
226
+ specific class: `<div class="lcp-customfield">`. You can customize
227
+ this using the customfield_tag and customfield_class parameters to
228
+ set a different tag (instead of the div) and a specific class
229
+ (instead of lcp-customfield).
230
 
231
  * **customfield_display_name** - To use with `customfield_display`.
232
  Use it to just print the value of the Custom field and not the
251
  The customizable elements (so far) are: author, catlink (category link), comments, date, excerpt, morelink ("Read More" link), thumbnail and title (post title).
252
 
253
  The parameters are:
254
+ `autor_tag, author_class, catlink_tag, catlink_class, comments_tag,
255
+ comments_class, date_tag, date_class, excerpt_tag, excerpt_class,
256
+ morelink_class, thumbnail_class, title_tag, title_class,
257
+ posts_morelink_class, customfield_tag, customfield_class`
258
 
259
  So let's say you want to wrap the displayed comments count with the p tag and a "lcp_comments" class, you would do:
260
  `[catlist id=7 comments=yes comments_tag=p comments_class=lcp_comments]`
385
 
386
  == Changelog ==
387
 
388
+ = 0.42 =
389
+ * Fixes excludeposts=this.
390
+ * Adds customfield_tag and customfield_class to customize an HTML tag
391
+ and CSS class for custom fields.
392
+
393
  = 0.41.2 =
394
  * Small bugfix with customfield_display_name (wasn't working now it
395
  is)