List category posts - Version 0.30

Version Description

  • Adds ability to exclude tags.
    • Changes excerpt. Since lot of users have asked for it, I once again modified the way the excerpt is shown. It now respects your theme's allowed HTML tags and doesn't strip them from the excerpt. If you want to strip tags, use excerpt_strip=yes.
Download this release

Release Info

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

Code changes from version 0.27.1 to 0.30

include/CatList.php CHANGED
@@ -16,17 +16,22 @@ class CatList{
16
  */
17
  public function __construct($atts) {
18
  $this->params = $atts;
19
-
20
  //Get the category posts:
21
  $this->get_lcp_category();
22
  $this->set_lcp_parameters();
23
  }
24
 
 
 
25
  /**
26
  * Order the parameters and query the DB for posts
27
  */
28
  private function set_lcp_parameters(){
29
- $args = array('cat'=> $this->lcp_category_id);
 
 
 
 
30
 
31
  $args = array_merge($args, array(
32
  'numberposts' => $this->params['numberposts'],
@@ -36,41 +41,36 @@ class CatList{
36
  ));
37
 
38
  //Exclude
39
- if(isset($this->params['excludeposts']) &&
40
- $this->params['excludeposts'] != '0'){
41
  $args['exclude'] = $this->params['excludeposts'];
42
  if (strpos($args['exclude'], 'this') !== FALSE) :
43
  $args['exclude'] = $args['exclude'] .
44
  ",". $this->lcp_get_current_post_id();
45
  endif;
46
- }
47
 
48
  // Post type, status, parent params:
49
- if(isset($this->params['post_type']) && $this->params['post_type'] != ''):
50
  $args['post_type'] = $this->params['post_type'];
51
  endif;
52
 
53
- if(isset($this->params['post_status']) && $this->params['post_status'] != ''):
54
  $args['post_status'] = $this->params['post_status'];
55
  endif;
56
 
57
- if(isset($this->params['post_parent']) &&
58
- $this->params['post_parent'] != '0'):
59
  $args['post_parent'] = $this->params['post_parent'];
60
  endif;
61
 
62
- if(isset($this->params['year']) &&
63
- $this->params['year'] != ''):
64
  $args['year'] = $this->params['year'];
65
  endif;
66
 
67
- if(isset($this->params['monthnum']) &&
68
- $this->params['monthnum'] != ''):
69
  $args['monthnum'] = $this->params['monthnum'];
70
  endif;
71
 
72
- if(isset($this->params['search']) &&
73
- $this->params['search'] != ''):
74
  $args['s'] = $this->params['search'];
75
  endif;
76
 
@@ -79,7 +79,7 @@ class CatList{
79
  * Custom fields 'customfield_name' & 'customfield_value'
80
  * should both be defined
81
  */
82
- if( !empty($this->params['customfield_value']) ):
83
  $args['meta_key'] = $this->params['customfield_name'];
84
  $args['meta_value'] = $this->params['customfield_value'];
85
  endif;
@@ -89,13 +89,22 @@ class CatList{
89
  $args['post_status'] = array('publish','private');
90
  endif;
91
 
 
 
 
 
 
 
 
 
 
92
  // Added custom taxonomy support
93
- if ( !empty($this->params['taxonomy']) && !empty($this->params['tags']) ):
94
  $args['tax_query'] = array(array(
95
- 'taxonomy' => $this->params['taxonomy'],
96
- 'field' => 'slug',
97
- 'terms' => explode(",",$this->params['tags'])
98
- ));
99
  elseif ( !empty($this->params['tags']) ):
100
  $args['tag'] = $this->params['tags'];
101
  endif;
@@ -103,6 +112,17 @@ class CatList{
103
  $this->lcp_categories_posts = get_posts($args);
104
  }
105
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  private function lcp_get_current_post_id(){
108
  global $post;
@@ -111,13 +131,21 @@ class CatList{
111
 
112
 
113
  private function get_lcp_category(){
114
- if ( isset($this->params['categorypage']) &&
115
  $this->params['categorypage'] == 'yes' ):
116
 
117
  $this->lcp_category_id = $this->lcp_get_current_category();
 
 
 
 
 
 
 
 
 
118
 
119
- elseif ( !empty($this->params['name']) ):
120
- if (preg_match('/,/', $this->params['name'])):
121
  $categories = '';
122
  $cat_array = explode(",", $this->params['name']);
123
 
@@ -132,7 +160,11 @@ class CatList{
132
  $this->lcp_category_id = $this->get_category_id_by_name($this->params['name']);
133
  endif;
134
  elseif ( isset($this->params['id']) && $this->params['id'] != '0' ):
135
- $this->lcp_category_id = $this->params['id'];
 
 
 
 
136
  endif;
137
  }
138
 
@@ -271,23 +303,36 @@ class CatList{
271
  $single->post_content) ):
272
 
273
  if($single->post_excerpt):
274
- $lcp_excerpt = $single->post_excerpt;
275
- else:
276
- $lcp_excerpt = strip_shortcodes(strip_tags($single->post_content));
277
  endif;
278
 
279
- $excerpt_length = intval($this->params['excerpt_size']);
280
- if (function_exists('wp_trim_words')):
281
- return wp_trim_words($lcp_excerpt, $excerpt_length);
282
- else:
283
- $exc_lim = intval($excerpt_length);
284
- return mb_substr($lcp_excerpt, 0, $exc_lim) . '...';
285
- endif;
286
  else:
287
  return null;
288
  endif;
289
  }
290
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
291
  /**
292
  * Get the post Thumbnail
293
  * @see http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
16
  */
17
  public function __construct($atts) {
18
  $this->params = $atts;
 
19
  //Get the category posts:
20
  $this->get_lcp_category();
21
  $this->set_lcp_parameters();
22
  }
23
 
24
+
25
+
26
  /**
27
  * Order the parameters and query the DB for posts
28
  */
29
  private function set_lcp_parameters(){
30
+ if (is_array($this->lcp_category_id)):
31
+ $args = array('category__and' => $this->lcp_category_id);
32
+ else:
33
+ $args = array('cat'=> $this->lcp_category_id);
34
+ endif;
35
 
36
  $args = array_merge($args, array(
37
  'numberposts' => $this->params['numberposts'],
41
  ));
42
 
43
  //Exclude
44
+ if( $this->lcp_not_empty('excludeposts') ):
 
45
  $args['exclude'] = $this->params['excludeposts'];
46
  if (strpos($args['exclude'], 'this') !== FALSE) :
47
  $args['exclude'] = $args['exclude'] .
48
  ",". $this->lcp_get_current_post_id();
49
  endif;
50
+ endif;
51
 
52
  // Post type, status, parent params:
53
+ if($this->lcp_not_empty('post_type')):
54
  $args['post_type'] = $this->params['post_type'];
55
  endif;
56
 
57
+ if($this->lcp_not_empty('post_status')):
58
  $args['post_status'] = $this->params['post_status'];
59
  endif;
60
 
61
+ if($this->lcp_not_empty('post_parent')):
 
62
  $args['post_parent'] = $this->params['post_parent'];
63
  endif;
64
 
65
+ if($this->lcp_not_empty('year')):
 
66
  $args['year'] = $this->params['year'];
67
  endif;
68
 
69
+ if($this->lcp_not_empty('monthnum')):
 
70
  $args['monthnum'] = $this->params['monthnum'];
71
  endif;
72
 
73
+ if($this->lcp_not_empty('search')):
 
74
  $args['s'] = $this->params['search'];
75
  endif;
76
 
79
  * Custom fields 'customfield_name' & 'customfield_value'
80
  * should both be defined
81
  */
82
+ if( $this->lcp_not_empty('customfield_value') ):
83
  $args['meta_key'] = $this->params['customfield_name'];
84
  $args['meta_value'] = $this->params['customfield_value'];
85
  endif;
89
  $args['post_status'] = array('publish','private');
90
  endif;
91
 
92
+ if ( $this->lcp_not_empty('exclude_tags') ):
93
+ $excluded_tags = explode(",", $this->params['exclude_tags']);
94
+ $tag_ids = array();
95
+ foreach ( $excluded_tags as $excluded):
96
+ $tag_ids[] = get_term_by('slug', $excluded, 'post_tag')->term_id;
97
+ endforeach;
98
+ $args['tag__not_in'] = $tag_ids;
99
+ endif;
100
+
101
  // Added custom taxonomy support
102
+ if ( $this->lcp_not_empty('taxonomy') && $this->lcp_not_empty('tags') ):
103
  $args['tax_query'] = array(array(
104
+ 'taxonomy' => $this->params['taxonomy'],
105
+ 'field' => 'slug',
106
+ 'terms' => explode(",",$this->params['tags'])
107
+ ));
108
  elseif ( !empty($this->params['tags']) ):
109
  $args['tag'] = $this->params['tags'];
110
  endif;
112
  $this->lcp_categories_posts = get_posts($args);
113
  }
114
 
115
+ private function lcp_not_empty($param){
116
+ if ( ( isset($this->params[$param]) ) &&
117
+ ( !empty($this->params[$param]) ) &&
118
+ ( $this->params[$param] != '0' ) &&
119
+ ( $this->params[$param] != '') ) :
120
+ return true;
121
+ else:
122
+ return false;
123
+ endif;
124
+ }
125
+
126
 
127
  private function lcp_get_current_post_id(){
128
  global $post;
131
 
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'])):
140
+ $categories = array();
141
+ $cat_array = explode("+", $this->params['name']);
142
+ foreach ($cat_array as $category) :
143
+ $id = $this->get_category_id_by_name($category);
144
+ $categories[] = $id;
145
+ endforeach;
146
+ $this->lcp_category_id = $categories;
147
 
148
+ elseif (preg_match('/,/', $this->params['name'])):
 
149
  $categories = '';
150
  $cat_array = explode(",", $this->params['name']);
151
 
160
  $this->lcp_category_id = $this->get_category_id_by_name($this->params['name']);
161
  endif;
162
  elseif ( isset($this->params['id']) && $this->params['id'] != '0' ):
163
+ if (preg_match('/\+/', $this->params['id'])):
164
+ $this->lcp_category_id = explode("+", $this->params['id']);
165
+ else:
166
+ $this->lcp_category_id = $this->params['id'];
167
+ endif;
168
  endif;
169
  }
170
 
303
  $single->post_content) ):
304
 
305
  if($single->post_excerpt):
306
+ return $lcp_excerpt = $this->lcp_trim_excerpt($single->post_excerpt);
 
 
307
  endif;
308
 
309
+ return $lcp_excerpt = $this->lcp_trim_excerpt($single->post_content);
 
 
 
 
 
 
310
  else:
311
  return null;
312
  endif;
313
  }
314
 
315
+ private function lcp_trim_excerpt($text = ''){
316
+ $excerpt_length = intval($this->params['excerpt_size']);
317
+
318
+ $text = strip_shortcodes($text);
319
+ $text = apply_filters('the_content', $text);
320
+ $text = str_replace(']]>',']]>', $text);
321
+
322
+ if( $this->lcp_not_empty('excerpt_strip') &&
323
+ $this->params['excerpt_strip'] == 'yes'):
324
+ $text = strip_tags($text);
325
+ endif;
326
+
327
+ $words = explode(' ', $text, $excerpt_length + 1);
328
+ if(count($words) > $excerpt_length) :
329
+ array_pop($words);
330
+ array_push($words, '...');
331
+ $text = implode(' ', $words);
332
+ endif;
333
+ return $text;
334
+ }
335
+
336
  /**
337
  * Get the post Thumbnail
338
  * @see http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
include/CatListDisplayer.php CHANGED
@@ -185,8 +185,17 @@ class CatListDisplayer {
185
  $lcp_display_output .= $this->get_excerpt($single);
186
  endif;
187
 
188
- $lcp_display_output .= '</' . $tag . '>';
 
 
 
 
 
 
 
 
189
 
 
190
  return $lcp_display_output;
191
  }
192
 
185
  $lcp_display_output .= $this->get_excerpt($single);
186
  endif;
187
 
188
+ if (!empty($this->params['posts_morelink'])) :
189
+ $href = 'href="'.get_permalink($single->ID) . '"';
190
+ $class = "";
191
+ if (!empty($this->params['posts_morelink_class'])) :
192
+ $class = 'class="' . $this->params['posts_morelink_class'] . '" ';
193
+ endif;
194
+ $readmore = $this->params['posts_morelink'];
195
+ $lcp_display_output .= ' <a ' . $href . ' ' . $class . ' >' . $readmore . '</a>';
196
+ endif;
197
 
198
+ $lcp_display_output .= '</' . $tag . '>';
199
  return $lcp_display_output;
200
  }
201
 
languages/list-category-posts-tr_TR.mo ADDED
Binary file
languages/list-category-posts-tr_TR.po ADDED
@@ -0,0 +1,128 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2012
2
+ # This file is distributed under the same license as the package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: list-category-posts\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp\n"
7
+ "POT-Creation-Date: 2012-12-19 13:23:13+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2013-01-27 20:15+0200\n"
12
+ "Last-Translator: HakanEr <hakanerwptr@gmail.com>\n"
13
+ "Language-Team: hakaner <hakanerwptr@gmail.com>\n"
14
+ "Plural-Forms: nplurals=2; plural=n != 1;\n"
15
+ "Language: turkish\n"
16
+ "X-Generator: Poedit 1.5.4\n"
17
+ "X-Poedit-SourceCharset: UTF-8\n"
18
+
19
+ #: include/ListCategoryPostsWidget.php:5
20
+ msgid ""
21
+ "List Category Posts allows you to list posts from a category into a post/"
22
+ "page using the [catlist] shortcode. This shortcode accepts a category name "
23
+ "or id, the order in which you want the posts to display, and the number of "
24
+ "posts to display. You can use [catlist] as many times as needed with "
25
+ "different arguments. Usage: [catlist argument1=value1 argument2=value2]."
26
+ msgstr ""
27
+ "List Category Posts, [catlist] kısa kodunu kullanarak bir yazı/sayfa içinde "
28
+ "bir kategorideki yazıları listeleyebilmenizi sağlar. Bu kısa kod, bir "
29
+ "kategori adı veya id kimliği, yazıları görüntülemek istediğiniz sıra ve "
30
+ "gösterilecek yazı sayısını kabul eder. Farklı değişkenler ile gerektiğinde "
31
+ "birçok kez [catlist] kullanabilirsiniz. Kullanımı: [catlist değişken1=değer1 "
32
+ "değişken2=değer2]."
33
+
34
+ #: include/ListCategoryPostsWidget.php:11
35
+ msgid "List posts from a specified category"
36
+ msgstr "Belirli bir kategorideki yazıları listele"
37
+
38
+ #: include/ListCategoryPostsWidget.php:12
39
+ msgid "List Category Posts"
40
+ msgstr "List Category Posts"
41
+
42
+ #: include/lcp_widget_form.php:40
43
+ msgid "Title"
44
+ msgstr "Başlık"
45
+
46
+ #: include/lcp_widget_form.php:47
47
+ msgid "Category"
48
+ msgstr "Kategori"
49
+
50
+ #: include/lcp_widget_form.php:65
51
+ msgid "Number of posts"
52
+ msgstr "Yazı sayısı"
53
+
54
+ #: include/lcp_widget_form.php:72
55
+ msgid "Offset"
56
+ msgstr "Kaydırma"
57
+
58
+ #: include/lcp_widget_form.php:78
59
+ msgid "Order by"
60
+ msgstr "Sırala"
61
+
62
+ #: include/lcp_widget_form.php:81 include/lcp_widget_form.php:123
63
+ msgid "Date"
64
+ msgstr "Tarih"
65
+
66
+ #: include/lcp_widget_form.php:82
67
+ msgid "Post title"
68
+ msgstr "Yazı başlığı"
69
+
70
+ #: include/lcp_widget_form.php:83 include/lcp_widget_form.php:127
71
+ msgid "Author"
72
+ msgstr "Yazar"
73
+
74
+ #: include/lcp_widget_form.php:84
75
+ msgid "Random"
76
+ msgstr "Rasgele"
77
+
78
+ #: include/lcp_widget_form.php:88
79
+ msgid "Order"
80
+ msgstr "Sıralama"
81
+
82
+ #: include/lcp_widget_form.php:91
83
+ msgid "Descending"
84
+ msgstr "Azalan"
85
+
86
+ #: include/lcp_widget_form.php:92
87
+ msgid "Ascending"
88
+ msgstr "Artan"
89
+
90
+ #: include/lcp_widget_form.php:96
91
+ msgid "Exclude categories (id's)"
92
+ msgstr "Kategorileri (id'ler) hariç tut"
93
+
94
+ #: include/lcp_widget_form.php:102
95
+ msgid "Exclude posts (id's)"
96
+ msgstr "Yazıları (id'ler) hariç tut"
97
+
98
+ #: include/lcp_widget_form.php:109
99
+ msgid "Show"
100
+ msgstr "Göster"
101
+
102
+ #: include/lcp_widget_form.php:112
103
+ msgid "Thumbnail - size"
104
+ msgstr "Küçük resim - boyut"
105
+
106
+ #: include/lcp_widget_form.php:131
107
+ msgid "Link to category"
108
+ msgstr "Kategoriye bağlantı"
109
+
110
+ #: include/lcp_widget_form.php:135
111
+ msgid "Excerpt"
112
+ msgstr "Alıntı"
113
+
114
+ #: include/lcp_widget_form.php:138
115
+ msgid "More link"
116
+ msgstr "Devamı bağlantısı"
117
+
118
+ #: list_cat_posts.php:102
119
+ msgid "How to use"
120
+ msgstr "Nasıl kullanılır"
121
+
122
+ #: list_cat_posts.php:103
123
+ msgid "Donate"
124
+ msgstr "Bağış yap"
125
+
126
+ #: list_cat_posts.php:104
127
+ msgid "Fork on Github"
128
+ msgstr "Github üzerinde incele"
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.27.1
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
@@ -11,7 +11,7 @@
11
  Domain Path: /languages/
12
  */
13
 
14
- /* Copyright 2008-2012 Fernando Briano (email : fernando@picandocodigo.net)
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
@@ -56,12 +56,14 @@ class ListCategoryPosts{
56
  'template' => 'default',
57
  'excerpt' => 'no',
58
  'excerpt_size' => '55',
 
59
  'excerpt_tag' =>'',
60
  'excerpt_class' =>'',
61
  'exclude' => '0',
62
  'excludeposts' => '0',
63
  'offset' => '0',
64
  'tags' => '',
 
65
  'content' => 'no',
66
  'content_tag' => '',
67
  'content_class' => '',
@@ -88,6 +90,8 @@ class ListCategoryPosts{
88
  'categorypage' => '',
89
  'morelink' => '',
90
  'morelink_class' => '',
 
 
91
  'year' => '',
92
  'monthnum' => '',
93
  'search' => ''
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
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
 
11
  Domain Path: /languages/
12
  */
13
 
14
+ /* Copyright 2008-2013 Fernando Briano (email : fernando@picandocodigo.net)
15
 
16
  This program is free software; you can redistribute it and/or modify
17
  it under the terms of the GNU General Public License as published by
56
  'template' => 'default',
57
  'excerpt' => 'no',
58
  'excerpt_size' => '55',
59
+ 'excerpt_strip' => '',
60
  'excerpt_tag' =>'',
61
  'excerpt_class' =>'',
62
  'exclude' => '0',
63
  'excludeposts' => '0',
64
  'offset' => '0',
65
  'tags' => '',
66
+ 'exclude_tags' => '',
67
  'content' => 'no',
68
  'content_tag' => '',
69
  'content_class' => '',
90
  'categorypage' => '',
91
  'morelink' => '',
92
  'morelink_class' => '',
93
+ 'posts_morelink' => '',
94
+ 'posts_morelink_class' => '',
95
  'year' => '',
96
  'monthnum' => '',
97
  'search' => ''
readme.txt CHANGED
@@ -4,12 +4,19 @@ 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.27.1
8
 
9
  == Description ==
10
- List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode.
11
 
12
- The 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 also display the post author, date, excerpt, custom field values, even the content! The [catlist] shortcode can be used as many times as needed with different arguments on each post/page.
 
 
 
 
 
 
 
13
 
14
  **Customization**: The different elements to display con be styled with CSS. you can define an HTML tag to wrap the element with, and a CSS class for this tag. Check [Other Notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for usage.
15
 
@@ -17,16 +24,8 @@ Great to use WordPress as a CMS, and create pages with several categories posts.
17
 
18
  **Widget**: It includes a widget which works pretty much the same as the plugin. Just add as many widgets as you want, and select all the available options from the Appearence > Widgets page.
19
 
20
- Since version 0.18, **this plugins does not work on servers with PHP 4**. If you're still using PHP 4 on your webhost, you should consider upgrading to PHP 5. WordPress 3.1 will be the last version to support PHP 4, from 3.2 and forward, only PHP 5 will be supported. You can still [download an older version of the plugin](https://wordpress.org/extend/plugins/list-category-posts/download/ "download an older version of the plugin") if you're using PHP 4.
21
-
22
  Please, read the information on [Other Notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) and [Changelog](http://wordpress.org/extend/plugins/list-category-posts/changelog/) to be aware of new functionality, and improvements to the plugin.
23
 
24
- **Usage**
25
-
26
- `[catlist argument1=value1 argument2=value2]`
27
-
28
- Please read [the instructions](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) on how to use it.
29
-
30
  **Support the plugin**
31
 
32
  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) :).
@@ -45,25 +44,35 @@ I've moved the development to [GitHub](https://github.com/picandocodigo/List-Cat
45
 
46
  ==Other notes==
47
 
48
- ==INSTRUCTIONS How to use the plugin==
49
 
50
 
51
- **Selecting the category**
52
- 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*.
53
- 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.
54
- You can use the *categorypage* parameter to make it detect the category id of the current posts, and list posts from that category.
55
- The parameters for choosing the category id are:
56
 
57
- * **name** - To display posts from a category using the category's name or slug. Ex: [catlist name=mycategory]
 
 
 
 
 
58
 
59
- * **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 (-)
60
 
61
- * **categorypage** - Set it to "yes" if you want to list the posts from the current post's category.
62
 
63
- **Other parameters**
 
 
 
 
 
 
64
 
65
  * **tags** - Tag support, you can display posts from a certain tag.
66
 
 
 
67
  * **orderby** - To customize the order. Valid values are:
68
  * **author** - Sort by the numeric author IDs.
69
  * **category** - Sort by the numeric category IDs.
@@ -95,13 +104,13 @@ You can use the *categorypage* parameter to make it detect the category id of th
95
 
96
  * **author** - Display the post's author next to the title. Default is 'no', use author=yes to activate it.
97
 
98
- * **dateformat** - Format of the date output. Default is get_option('date_format'). Check http://codex.wordpress.org/Formatting_Date_and_Time for possible formats.
99
 
100
- * **excerpt** - Display the post's excerpt. Default is 'no', use excerpt=yes to activate it. If you don't have an excerpt in your post, the plugin will fetch this text from the content, striping its html tags and shortcodes. The limit is set by the *excerpt_size* parameter (55 words by default).
101
 
102
- * **excerpt_size**
103
- * If you are using WordPress >= 3.3: Set the number of *words* to display from the excerpt. Default is 55. Eg: `excerpt_size = 30`
104
- * If for some reason you can't update your WordPress and are still using WordPress < 3.3, this will use a fallback function instead of `wp_trim_words` where you'll have to set the number of *characters* insted of words with this parameter.
105
 
106
  * **excludeposts** - IDs of posts to exclude from the list. Use 'this' to exclude the current post. Ex: [catlist excludeposts=this,12,52,37]
107
 
@@ -145,13 +154,15 @@ You can use the *categorypage* parameter to make it detect the category id of th
145
 
146
  * **morelink** - Include a "more" link to access the category archive for the category. The link is inserted after listing the posts. It receives a string of characters as a parameter which will be used as the text of the link. Example: [catlist id=38 morelink="Read more"]
147
 
 
 
148
  == HTML & CSS Customization ==
149
 
150
  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).
151
 
152
  The parameters are:
153
  `autor_tag, author_class, catlink_tag, catlink_class, comments_tag, comments_class, date_tag, date_class,
154
- excerpt_tag, excerpt_class, morelink_class, thumbnail_class, title_tag, title_class`
155
 
156
  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:
157
  `[catlist id=7 comments=yes comments_tag=p comments_class=lcp_comments]`
@@ -175,7 +186,7 @@ If the template file were templatename.php.
175
  You can have as many different templates as you want, and use them in different pages and posts. The template code is pretty well documented, so if you're a bit familiar with HTML and PHP, you'll have no problems creating your own template. I'm planning on reworking the template system in order to have a really user friendly way to create templates.
176
 
177
  == Frequently Asked Questions ==
178
- * **Instructions** on how to use the plugin: http://wordpress.org/extend/plugins/list-category-posts/other_notes/
179
  * **Template system** how to customize the way the posts are shown: http://wordpress.org/extend/plugins/list-category-posts/other_notes/. I am aware the Template System is not really friendly right now, I'll work on this whenever I get the time to work on the plugin for a while.
180
  * **New feature requests, Bug fixes, enhancements** - You can post them on [GitHub Issues](https://github.com/picandocodigo/List-Category-Posts/issues).
181
  * **Questions** If you have any usage questions, go to [WordPress Answers](http://wordpress.stackexchange.com/) for support. It's a great place with a large community of WordPress users and developers. Just [ask your question](http://wordpress.stackexchange.com/questions/ask?tags=plugin-list-category-posts) using the 'plugin-list-category-post' tag.
@@ -183,11 +194,30 @@ You can have as many different templates as you want, and use them in different
183
 
184
  * **FAQ**
185
 
 
 
186
  **Plugin could not be activated because it triggered a fatal error.**
187
  *Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /.../wp-content/plugins/list-category-posts/include/CatListDisplayer.php on line 10*
188
  Please check:
189
  http://wordpress.stackexchange.com/questions/9338/list-category-posts-plugin-upgrade-fails-fatal-error/9340#9340
190
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
191
  **Please do not ask for support when you are having issues with your CSS**. I can't solve every user's CSS problems. Feel free to ask on the forums or WP Answers. But please, **[read the instructions first](http://wordpress.org/extend/plugins/list-category-posts/other_notes/)**.
192
 
193
  == Upgrade Notice ==
@@ -210,11 +240,24 @@ Template system has changed. Now the posts loop must be defined inside the templ
210
  = 0.8 =
211
  Widget built for WordPress 2.8's Widget API, so you need at least WP 2.8 to use the widget.
212
 
213
- = 0.9 =
214
  Template system has changed. Custom templates should be stored in WordPress theme folder.
215
 
216
  == Changelog ==
217
 
 
 
 
 
 
 
 
 
 
 
 
 
 
218
  = 0.27.1 =
219
 
220
  * Sets minimum version to WordPress 3.3, since wp_trim_words was introduced in that version. Adds workaround for people using WordPress < 3.3.
@@ -272,7 +315,7 @@ This update is dedicated to [Michelle K McGinnis](http://friendlywebconsulting.c
272
 
273
  * Fixed thumbnail size parameter, added usage example on README.
274
  * Added space after author and date http://wordpress.org/support/topic/plugin-list-category-posts-space-required-after
275
-
276
  = 0.22.2 =
277
 
278
  * Fixed bug with the categorypage=yes param.
4
  Tags: list, categories, posts, cms
5
  Requires at least: 3.3
6
  Tested up to: 3.5
7
+ Stable tag: 0.30
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:
11
 
12
+ `[catlist id=1]`
13
+
14
+ `[catlist name="news"]`
15
+
16
+ The 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 also display the post author, date, excerpt, custom field values, even the content! The [catlist] shortcode can be used as many times as needed with different arguments on each post/page. You can add a lot more parameters according to what and how you want to show your post's list:
17
+ `[catlist id=1 numberposts=10]`
18
+
19
+ **Please read [the instructions](http://wordpress.org/extend/plugins/list-category-posts/other_notes/)** to learn what parameters are available and how to use them.
20
 
21
  **Customization**: The different elements to display con be styled with CSS. you can define an HTML tag to wrap the element with, and a CSS class for this tag. Check [Other Notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for usage.
22
 
24
 
25
  **Widget**: It includes a widget which works pretty much the same as the plugin. Just add as many widgets as you want, and select all the available options from the Appearence > Widgets page.
26
 
 
 
27
  Please, read the information on [Other Notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) and [Changelog](http://wordpress.org/extend/plugins/list-category-posts/changelog/) to be aware of new functionality, and improvements to the 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) :).
44
 
45
  ==Other notes==
46
 
47
+ ==INSTRUCTIONS on how to use the plugin==
48
 
49
 
50
+ ==Selecting the category==
51
+ The plugin can figure out the category from which you want to list posts in several ways. **You should use only one of these methods** since these are all mutually exclusive, weird results are expected when using more than one:
 
 
 
52
 
53
+ * Using the *category id*.
54
+ * **id** - To display posts from a category using the category's id. Ex: `[catlist id=24]`.
55
+ * The *category name or slug*.
56
+ * **name** - To display posts from a category using the category's name or slug. Ex: `[catlist name=mycategory]`
57
+ * *Detecting the current post's category*. You can use the *categorypage* parameter to make it detect the category id of the current posts, and list posts from that category.
58
+ * **categorypage** - Set it to "yes" if you want to list the posts from the current post's category. `[catlist categorypage="yes"]`
59
 
60
+ When using List Category Posts whithout a category id, name or slug, it will post the latest posts from every category.
61
 
62
+ ==Using several categories==
63
 
64
+ * **include** posts from several categories with **AND** relationship, posts that belong to all of the listed categories (note this does not show posts from any children of these categories): `[catlist id=17+25+2]` - `[catlist name=sega+nintendo]`.
65
+ * **include** posts from several categories with **OR** relationship, posts that belong to either one of the listed categories: `[catlist id=17,24,32]` - `[catlist name=sega,nintendo]`.
66
+ * **exclude** a category with the minus sign (-): `[catlist id=11,-32,16]`.
67
+
68
+
69
+
70
+ ==Other parameters==
71
 
72
  * **tags** - Tag support, you can display posts from a certain tag.
73
 
74
+ * **exclude_tags** - Exclude posts from one or more tags: `[catlist tag="videogames" exclude_tags="sega,sony"]`
75
+
76
  * **orderby** - To customize the order. Valid values are:
77
  * **author** - Sort by the numeric author IDs.
78
  * **category** - Sort by the numeric category IDs.
104
 
105
  * **author** - Display the post's author next to the title. Default is 'no', use author=yes to activate it.
106
 
107
+ * **dateformat** - Format of the date output. The default format is the one you've set on your WordPress settings. Example: `[catlist id=42 dateformat="l F dS, Y"]` would display the date as "Monday January 21st, 2013". Check http://codex.wordpress.org/Formatting_Date_and_Time for more options to display date.
108
 
109
+ * **excerpt** - Display the post's excerpt. Default is 'no', use excerpt=yes to activate it. If you don't have an excerpt in your post, the plugin will fetch this text from the content, striping its images and shortcodes. The limit is set by the *excerpt_size* parameter (55 words by default). It respects your theme's allowed HTML tags and doesn't strip them from the excerpt. If you want to strip tags, use `excerpt_strip=yes`.
110
 
111
+ * **excerpt_size** - Set the number of *words* to display from the excerpt. Default is 55. Eg: `excerpt_size = 30`
112
+
113
+ * **excerpt_strip** - Set it to `yes` to strip the excerpt's HTML tags.
114
 
115
  * **excludeposts** - IDs of posts to exclude from the list. Use 'this' to exclude the current post. Ex: [catlist excludeposts=this,12,52,37]
116
 
154
 
155
  * **morelink** - Include a "more" link to access the category archive for the category. The link is inserted after listing the posts. It receives a string of characters as a parameter which will be used as the text of the link. Example: [catlist id=38 morelink="Read more"]
156
 
157
+ * **posts_morelink** - Include a "read more" link after each post. It receives a string of characters as a parameter which will be used as the text of the link. Example: [catlist id=38 posts_morelink="Read more about this post"]
158
+
159
  == HTML & CSS Customization ==
160
 
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:
168
  `[catlist id=7 comments=yes comments_tag=p comments_class=lcp_comments]`
186
  You can have as many different templates as you want, and use them in different pages and posts. The template code is pretty well documented, so if you're a bit familiar with HTML and PHP, you'll have no problems creating your own template. I'm planning on reworking the template system in order to have a really user friendly way to create templates.
187
 
188
  == Frequently Asked Questions ==
189
+ * **Instructions** on how to use the plugin: http://wordpress.org/extend/plugins/list-category-posts/other_notes/ - **Read it**.
190
  * **Template system** how to customize the way the posts are shown: http://wordpress.org/extend/plugins/list-category-posts/other_notes/. I am aware the Template System is not really friendly right now, I'll work on this whenever I get the time to work on the plugin for a while.
191
  * **New feature requests, Bug fixes, enhancements** - You can post them on [GitHub Issues](https://github.com/picandocodigo/List-Category-Posts/issues).
192
  * **Questions** If you have any usage questions, go to [WordPress Answers](http://wordpress.stackexchange.com/) for support. It's a great place with a large community of WordPress users and developers. Just [ask your question](http://wordpress.stackexchange.com/questions/ask?tags=plugin-list-category-posts) using the 'plugin-list-category-post' tag.
194
 
195
  * **FAQ**
196
 
197
+ Since version 0.18, **this plugins does not work on servers with PHP 4**. If you're still using PHP 4 on your webhost, you should consider upgrading to PHP 5. WordPress 3.1 was the last version to support PHP 4, from 3.2 and forward, only PHP 5 is supported. You can still [download an older version of the plugin](https://wordpress.org/extend/plugins/list-category-posts/download/ "download an older version of the plugin") if you're using PHP 4.
198
+
199
  **Plugin could not be activated because it triggered a fatal error.**
200
  *Parse error: syntax error, unexpected T_STRING, expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /.../wp-content/plugins/list-category-posts/include/CatListDisplayer.php on line 10*
201
  Please check:
202
  http://wordpress.stackexchange.com/questions/9338/list-category-posts-plugin-upgrade-fails-fatal-error/9340#9340
203
 
204
+ **How to not display the title**
205
+
206
+ You have to add a CSS class to the title with the `title_class` parameter. Then edit the title_class class in your theme's CSS file. Something like this:
207
+
208
+ In the post:
209
+ `[catlist id=3 title_class=lcp_title numberposts=1]`
210
+
211
+ And in your theme's CSS:
212
+
213
+ `.lcp_title{
214
+ display: none;
215
+ }`
216
+
217
+ **How to insert the shortcode on the theme and not a post or page**
218
+
219
+ `<?php echo do_shortcode("[catlist id=3]"); ?>`
220
+
221
  **Please do not ask for support when you are having issues with your CSS**. I can't solve every user's CSS problems. Feel free to ask on the forums or WP Answers. But please, **[read the instructions first](http://wordpress.org/extend/plugins/list-category-posts/other_notes/)**.
222
 
223
  == Upgrade Notice ==
240
  = 0.8 =
241
  Widget built for WordPress 2.8's Widget API, so you need at least WP 2.8 to use the widget.
242
 
243
+ = 0.9 =
244
  Template system has changed. Custom templates should be stored in WordPress theme folder.
245
 
246
  == Changelog ==
247
 
248
+ = 0.30 =
249
+ * Adds ability to exclude tags.
250
+ * Changes excerpt. Since lot of users have asked for it, I once again modified the way the excerpt is shown. It now respects your theme's allowed HTML tags and doesn't strip them from the excerpt. If you want to strip tags, use `excerpt_strip=yes`.
251
+
252
+ = 0.29 =
253
+ * Adds turkish translation, thanks [Hakan Er](http://hakanertr.wordpress.com/) for writing this translation! :)
254
+ * Adds "AND" relationship to several categories. Thanks to [hvianna](http://wordpress.org/support/profile/hvianna) from the WordPress forums who [implemented this feature](http://wordpress.org/support/topic/list-only-posts-that-belong-to-two-or-more-categories-solution) :D
255
+ * More improvements on readme.
256
+
257
+ = 0.28 =
258
+ * Improvements on readme, faqs.
259
+ * New posts_morelink param: adds a 'read more' link to each post.
260
+
261
  = 0.27.1 =
262
 
263
  * Sets minimum version to WordPress 3.3, since wp_trim_words was introduced in that version. Adds workaround for people using WordPress < 3.3.
315
 
316
  * Fixed thumbnail size parameter, added usage example on README.
317
  * Added space after author and date http://wordpress.org/support/topic/plugin-list-category-posts-space-required-after
318
+
319
  = 0.22.2 =
320
 
321
  * Fixed bug with the categorypage=yes param.