List category posts - Version 0.24

Version Description

  • Fixes "excerpt doesn't strip shortcodes" - https://github.com/picandocodigo/List-Category-Posts/issues/5
    • Exclude currently displayed post - 1, 2
    • Add title to category title 1, will be improved.
    • Attempting to condition whitespaces to WordPress Coding Standard (emacs php-mode sucks for this...)
    • No more git-svn crap, now I'm developing this over at (GitHub)[https://github.com/picandocodigo/List-Category-Posts] and copying it into the WordPress SVN Repo.
Download this release

Release Info

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

Code changes from version 0.23.2 to 0.24

include/CatList.php CHANGED
@@ -6,253 +6,280 @@
6
  */
7
 
8
  class CatList{
9
- private $params = array();
10
- private $lcp_category_id = 0;
11
- private $category_param;
12
-
13
- /**
14
- * Constructor gets the shortcode attributes as parameter
15
- * @param array $atts
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
- * Order the parameters and query the DB for posts
26
- */
27
- private function set_lcp_parameters(){
28
- $args = array('cat'=> $this->lcp_category_id);
29
-
30
- $args = array_merge($args, array(
31
- 'numberposts' => $this->params['numberposts'],
32
- 'orderby' => $this->params['orderby'],
33
- 'order' => $this->params['order'],
34
- 'offset' => $this->params['offset']
35
- ));
36
-
37
- //Exclude
38
- if(isset($this->params['excludeposts']) && $this->params['excludeposts'] != '0'): $args['exclude'] = $this->params['excludeposts']; endif;
39
-
40
- // Post type and post parent:
41
- if(isset($this->params['post_type']) && $this->params['post_type'] != '0'): $args['post_type'] = $this->params['post_type']; endif;
42
- if(isset($this->params['post_parent']) && $this->params['post_parent'] != '0'): $args['post_parent'] = $this->params['post_parent']; endif;
43
-
44
- // Custom fields 'customfield_name' & 'customfield_value' should both be defined
45
- if( !empty($this->params['customfield_value']) ):
46
- $args['meta_key'] = $this->params['customfield_name'];
47
- $args['meta_value'] = $this->params['customfield_value'];
48
- endif;
49
-
50
- //Get private posts
51
- if(is_user_logged_in()){
52
- $args['post_status'] = array('publish','private');
53
- }
54
-
55
- // Added custom taxonomy support
56
- if ( !empty($this->params['taxonomy']) && !empty($this->params['tags']) ) {
57
- $args['tax_query'] = array(array(
58
- 'taxonomy' => $this->params['taxonomy'],
59
- 'field' => 'slug',
60
- 'terms' => explode(",",$this->params['tags'])
61
- ));
62
- } else if ( !empty($this->params['tags']) ) {
63
- $args['tag'] = $this->params['tags'];
64
- }
65
-
66
- $this->lcp_categories_posts = get_posts($args);
67
- }
68
-
69
-
70
- private function get_lcp_category(){
71
- if ( isset($this->params['categorypage']) && $this->params['categorypage'] == 'yes' ){
72
- $this->lcp_category_id = $this->lcp_get_current_category();
73
- } elseif ( !empty($this->params['name']) ){
74
- if (preg_match('/,/', $this->params['name'])){
75
- $categories = '';
76
- $cat_array = explode(",", $this->params['name']);
77
- foreach ($cat_array as $category) {
78
- $id = $this->get_category_id_by_name($category);
79
- $categories .= $id . ",";
80
- }
81
- $this->lcp_category_id = $categories;
82
- } else {
83
- $this->lcp_category_id = $this->get_category_id_by_name($this->params['name']);
84
- }
85
- } elseif ( isset($this->params['id']) && $this->params['id'] != '0' ){
86
- $this->lcp_category_id = $this->params['id'];
87
- }
88
- }
89
-
90
- public function lcp_get_current_category(){
91
- global $post;
92
- $categories = get_the_category($post->ID);
93
- return $categories[0]->cat_ID;
94
- }
95
-
96
- /**
97
- * Get the category id from its name
98
- * by Eric Celeste / http://eric.clst.org
99
- */
100
- private function get_category_id_by_name($cat_name){
101
- #TODO: Support multiple names (this used to work, but not anymore)
102
- //We check if the name gets the category id, if not, we check the slug.
103
- $term = get_term_by('slug', $cat_name, 'category');
104
- if (!$term):
105
- $term = get_term_by('name', $cat_name, 'category');
106
- endif;
107
-
108
- return ($term) ? $term->term_id : 0;
109
- }
110
-
111
- public function get_category_id(){
112
- return $this->lcp_category_id;
113
- }
114
-
115
- public function get_categories_posts(){
116
- return $this->lcp_categories_posts;
117
- }
118
-
119
- /**
120
- * Load category name and link to the category:
121
- */
122
- public function get_category_link(){
123
- if($this->params['catlink'] == 'yes' && $this->lcp_category_id != 0){
124
- $cat_link = get_category_link($this->lcp_category_id);
125
- $cat_title = get_cat_name($this->lcp_category_id);
126
- return '<a href="' . $cat_link . '" title="' . $cat_title . '">' . $cat_title . '</a>';
127
- } else {
128
- return null;
129
- }
130
- }
131
-
132
- /**
133
- * Display custom fields.
134
- * @see http://codex.wordpress.org/Function_Reference/get_post_custom
135
- * @param string $custom_key
136
- * @param int $post_id
137
- */
138
- public function get_custom_fields($custom_key, $post_id){
139
- if($this->params['customfield_display'] != ''){
140
- $lcp_customs = '';
141
- //Doesn't work for many when having spaces:
142
- $custom_key = trim($custom_key);
143
- //Create array for many fields:
144
- $custom_array = explode(",", $custom_key);
145
- //Get post custom fields:
146
- $custom_fields = get_post_custom($post_id);
147
- //Loop on custom fields and if there's a value, add it:
148
- foreach ($custom_array as $something){
149
- $my_custom_field = $custom_fields[$something];
150
- if (sizeof($my_custom_field) > 0 ):
151
- foreach ( $my_custom_field as $key => $value ){
152
- $lcp_customs .= "<div class=\"lcp-customfield\">" . $something. " : " . $value . "</div>";
153
- }
154
- endif;
155
- }
156
- return $lcp_customs;
157
- } else {
158
- return null;
159
- }
160
- }
161
-
162
- public function get_comments_count($single){
163
- if (isset($this->params['comments']) && $this->params['comments'] == 'yes'){
164
- return ' (' . $single->comment_count . ')';
165
- } else {
166
- return null;
167
- }
168
- }
169
-
170
- public function get_author_to_show($single){
171
- if ($this->params['author']=='yes'){
172
- $lcp_userdata = get_userdata($single->post_author);
173
- return $lcp_userdata->display_name;
174
- } else {
175
- return null;
176
- }
177
- }
178
-
179
-
180
-
181
- public function get_date_to_show($single){
182
- if ($this->params['date']=='yes'){
183
- //by Verex, great idea!
184
- return get_the_time($this->params['dateformat'], $single);
185
- } else {
186
- return null;
187
- }
188
- }
189
-
190
- public function get_content($single){
191
- if (isset($this->params['content']) && $this->params['content'] =='yes' && $single->post_content){
192
- $lcp_content = $single->post_content;
193
- //Need to put some more thought on this!
194
- //Added to stop a post with catlist to display an infinite loop of catlist shortcode parsing
195
- /*if (preg_match("/\[catlist.*\]/", $lcp_content, $regmatch)){
196
- foreach ($regmatch as $match){
197
- $lcp_content = str_replace($match, '(...)',$lcp_content);
198
- }
199
- }*/
200
- $lcp_content = apply_filters('the_content', $lcp_content); // added to parse shortcodes
201
- $lcp_content = str_replace(']]>', ']]&gt', $lcp_content); // added to parse shortcodes
202
- return $lcp_content;
203
- } else {
204
- return null;
205
- }
206
- }
207
-
208
- public function get_excerpt($single){
209
- if ($this->params['excerpt']=='yes' && !($this->params['content']=='yes' && $single->post_content) ){
210
- if($single->post_excerpt){
211
- return $single->post_excerpt;
212
- }
213
- $lcp_excerpt = strip_tags($single->post_content);
214
- $exc_lim = intval($this->params['excerpt_size']);
215
- $lcp_excerpt = substr($lcp_excerpt, 0, $exc_lim) . '...';
216
- return $lcp_excerpt;
217
- } else {
218
- return null;
219
- }
220
- }
221
-
222
- /**
223
- * Get the post Thumbnail
224
- * @see http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
225
- * @param unknown_type $single
226
- *
227
- */
228
- public function get_thumbnail($single, $lcp_thumb_class = null){
229
- if ($this->params['thumbnail']=='yes'){
230
- $lcp_thumbnail = '';
231
- if ( has_post_thumbnail($single->ID) ) {
232
-
233
- if ( in_array( $this->params['thumbnail_size'], array('thumbnail', 'medium', 'large', 'full') ) ) :
234
- $lcp_thumb_size = $this->params['thumbnail_size'];
235
- elseif ($this->params['thumbnail_size']):
236
- $lcp_thumb_size = explode(",", $this->params['thumbnail_size']);
237
- else :
238
- $lcp_thumb_size = 'thumbnail';
239
- endif;//thumbnail size
240
-
241
- $lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">';
242
-
243
- $lcp_thumbnail .= get_the_post_thumbnail(
244
- $single->ID,
245
- $lcp_thumb_size,
246
- ($lcp_thumb_class != null) ? array('class' => $lcp_thumb_class ) : null
247
- );
248
- $lcp_thumbnail .= '</a>';
249
-
250
- }
251
- return $lcp_thumbnail;
252
- } else {
253
- return null;
254
- }
255
- }
256
 
 
 
 
 
 
 
 
 
 
 
257
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
258
  }
6
  */
7
 
8
  class CatList{
9
+ private $params = array();
10
+ private $lcp_category_id = 0;
11
+ private $category_param;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
 
13
+ /**
14
+ * Constructor gets the shortcode attributes as parameter
15
+ * @param array $atts
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
+ * Order the parameters and query the DB for posts
26
+ */
27
+ private function set_lcp_parameters(){
28
+ $args = array('cat'=> $this->lcp_category_id);
29
+
30
+ $args = array_merge($args, array(
31
+ 'numberposts' => $this->params['numberposts'],
32
+ 'orderby' => $this->params['orderby'],
33
+ 'order' => $this->params['order'],
34
+ 'offset' => $this->params['offset']
35
+ ));
36
+
37
+ //Exclude
38
+ if(isset($this->params['excludeposts']) && $this->params['excludeposts'] != '0'){
39
+ $args['exclude'] = $this->params['excludeposts'];
40
+ if (strpos($args['exclude'], 'this') !== FALSE) {
41
+ $args['exclude'] = $args['exclude'] . ",". $this->lcp_get_current_post_id();
42
+ }
43
+ }
44
+
45
+ // Post type and post parent:
46
+ if(isset($this->params['post_type']) && $this->params['post_type'] != '0'):
47
+ $args['post_type'] = $this->params['post_type'];
48
+ endif;
49
+ if(isset($this->params['post_parent']) && $this->params['post_parent'] != '0'):
50
+ $args['post_parent'] = $this->params['post_parent'];
51
+ endif;
52
+
53
+ // Custom fields 'customfield_name' & 'customfield_value' should both be defined
54
+ if( !empty($this->params['customfield_value']) ):
55
+ $args['meta_key'] = $this->params['customfield_name'];
56
+ $args['meta_value'] = $this->params['customfield_value'];
57
+ endif;
58
+
59
+ //Get private posts
60
+ if(is_user_logged_in()){
61
+ $args['post_status'] = array('publish','private');
62
+ }
63
+
64
+ // Added custom taxonomy support
65
+ if ( !empty($this->params['taxonomy']) && !empty($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
+ } else if ( !empty($this->params['tags']) ) {
72
+ $args['tag'] = $this->params['tags'];
73
+ }
74
+
75
+ $this->lcp_categories_posts = get_posts($args);
76
+ }
77
+
78
+
79
+ private function lcp_get_current_post_id(){
80
+ global $post;
81
+ return $post->ID;
82
+ }
83
+
84
+
85
+ private function get_lcp_category(){
86
+ if ( isset($this->params['categorypage']) && $this->params['categorypage'] == 'yes' ){
87
+ $this->lcp_category_id = $this->lcp_get_current_category();
88
+ } elseif ( !empty($this->params['name']) ){
89
+ if (preg_match('/,/', $this->params['name'])){
90
+ $categories = '';
91
+ $cat_array = explode(",", $this->params['name']);
92
+ foreach ($cat_array as $category) {
93
+ $id = $this->get_category_id_by_name($category);
94
+ $categories .= $id . ",";
95
+ }
96
+ $this->lcp_category_id = $categories;
97
+ } else {
98
+ $this->lcp_category_id = $this->get_category_id_by_name($this->params['name']);
99
+ }
100
+ } elseif ( isset($this->params['id']) && $this->params['id'] != '0' ){
101
+ $this->lcp_category_id = $this->params['id'];
102
+ }
103
+ }
104
+
105
+ public function lcp_get_current_category(){
106
+ global $post;
107
+ $categories = get_the_category($post->ID);
108
+ return $categories[0]->cat_ID;
109
+ }
110
+
111
+ /**
112
+ * Get the category id from its name
113
+ * by Eric Celeste / http://eric.clst.org
114
+ */
115
+ private function get_category_id_by_name($cat_name){
116
+ //TODO: Support multiple names (this used to work, but not anymore)
117
+ //We check if the name gets the category id, if not, we check the slug.
118
+ $term = get_term_by('slug', $cat_name, 'category');
119
+ if (!$term):
120
+ $term = get_term_by('name', $cat_name, 'category');
121
+ endif;
122
+
123
+ return ($term) ? $term->term_id : 0;
124
+ }
125
+
126
+ public function get_category_id(){
127
+ return $this->lcp_category_id;
128
+ }
129
+
130
+ public function get_categories_posts(){
131
+ return $this->lcp_categories_posts;
132
+ }
133
+
134
+ /**
135
+ * Load category name and link to the category:
136
+ */
137
+ public function get_category_link(){
138
+ if($this->params['catlink'] == 'yes' && $this->lcp_category_id != 0){
139
+ $cat_link = get_category_link($this->lcp_category_id);
140
+ $cat_title = get_cat_name($this->lcp_category_id);
141
+ return '<a href="' . $cat_link . '" title="' . $cat_title . '">' .
142
+ ($this->params['catlink_string'] !== '' ? $this->params['catlink_string'] : $cat_title) . '</a>';
143
+ } else {
144
+ return null;
145
+ }
146
+ }
147
+
148
+ /**
149
+ * Display custom fields.
150
+ * @see http://codex.wordpress.org/Function_Reference/get_post_custom
151
+ * @param string $custom_key
152
+ * @param int $post_id
153
+ */
154
+ public function get_custom_fields($custom_key, $post_id){
155
+ if($this->params['customfield_display'] != ''){
156
+ $lcp_customs = '';
157
+ //Doesn't work for many when having spaces:
158
+ $custom_key = trim($custom_key);
159
+ //Create array for many fields:
160
+ $custom_array = explode(",", $custom_key);
161
+ //Get post custom fields:
162
+ $custom_fields = get_post_custom($post_id);
163
+ //Loop on custom fields and if there's a value, add it:
164
+ foreach ($custom_array as $something){
165
+ $my_custom_field = $custom_fields[$something];
166
+ if (sizeof($my_custom_field) > 0 ):
167
+ foreach ( $my_custom_field as $key => $value ){
168
+ $lcp_customs .= "<div class=\"lcp-customfield\">" . $something. " : " . $value . "</div>";
169
+ }
170
+ endif;
171
+ }
172
+ return $lcp_customs;
173
+ } else {
174
+ return null;
175
+ }
176
+ }
177
+
178
+ public function get_comments_count($single){
179
+ if (isset($this->params['comments']) && $this->params['comments'] == 'yes'){
180
+ return ' (' . $single->comment_count . ')';
181
+ } else {
182
+ return null;
183
+ }
184
+ }
185
+
186
+ public function get_author_to_show($single){
187
+ if ($this->params['author']=='yes'){
188
+ $lcp_userdata = get_userdata($single->post_author);
189
+ return $lcp_userdata->display_name;
190
+ } else {
191
+ return null;
192
+ }
193
+ }
194
+
195
+
196
+
197
+ public function get_date_to_show($single){
198
+ if ($this->params['date']=='yes'){
199
+ //by Verex, great idea!
200
+ return get_the_time($this->params['dateformat'], $single);
201
+ } else {
202
+ return null;
203
+ }
204
+ }
205
+
206
+ public function get_content($single){
207
+ if (
208
+ isset($this->params['content']) &&
209
+ $this->params['content'] =='yes' &&
210
+ $single->post_content){
211
+ $lcp_content = $single->post_content;
212
+ //Need to put some more thought on this!
213
+ //Added to stop a post with catlist to display an infinite loop of catlist shortcode parsing
214
+ /*if (preg_match("/\[catlist.*\]/", $lcp_content, $regmatch)){
215
+ foreach ($regmatch as $match){
216
+ $lcp_content = str_replace($match, '(...)',$lcp_content);
217
+ }
218
+ }*/
219
+ // added to parse shortcodes
220
+ $lcp_content = apply_filters('the_content', $lcp_content);
221
+ $lcp_content = str_replace(']]>', ']]&gt', $lcp_content);
222
+ return $lcp_content;
223
+ } else {
224
+ return null;
225
+ }
226
+ }
227
+
228
+ public function get_excerpt($single){
229
+ if (
230
+ $this->params['excerpt']=='yes' &&
231
+ !($this->params['content']=='yes' &&
232
+ $single->post_content) ){
233
+ /*
234
+ * Strip shortcodes - #5
235
+ * http://codex.wordpress.org/Function_Reference/strip_shortcodes
236
+ */
237
+ if($single->post_excerpt){
238
+ return $single->post_excerpt;
239
+ }
240
+ $lcp_excerpt = strip_shortcodes(strip_tags($single->post_content));
241
+ $exc_lim = intval($this->params['excerpt_size']);
242
+ $lcp_excerpt = mb_substr($lcp_excerpt, 0, $exc_lim) . '...';
243
+ return $lcp_excerpt;
244
+ } else {
245
+ return null;
246
+ }
247
+ }
248
+
249
+ /**
250
+ * Get the post Thumbnail
251
+ * @see http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
252
+ * @param unknown_type $single
253
+ *
254
+ */
255
+ public function get_thumbnail($single, $lcp_thumb_class = null){
256
+ if ($this->params['thumbnail']=='yes'){
257
+ $lcp_thumbnail = '';
258
+ if ( has_post_thumbnail($single->ID) ) {
259
+
260
+ if ( in_array(
261
+ $this->params['thumbnail_size'],
262
+ array('thumbnail', 'medium', 'large', 'full'))
263
+ ) {
264
+ $lcp_thumb_size = $this->params['thumbnail_size'];
265
+ }elseif ($this->params['thumbnail_size']){
266
+ $lcp_thumb_size = explode(",", $this->params['thumbnail_size']);
267
+ }else {
268
+ $lcp_thumb_size = 'thumbnail';
269
+ }//thumbnail size
270
+
271
+ $lcp_thumbnail = '<a href="' . get_permalink($single->ID).'">';
272
+
273
+ $lcp_thumbnail .= get_the_post_thumbnail(
274
+ $single->ID,
275
+ $lcp_thumb_size,
276
+ ($lcp_thumb_class != null) ? array('class' => $lcp_thumb_class ) : null
277
+ );
278
+ $lcp_thumbnail .= '</a>';
279
+ }
280
+ return $lcp_thumbnail;
281
+ } else {
282
+ return null;
283
+ }
284
+ }
285
  }
include/CatListDisplayer.php CHANGED
@@ -1,192 +1,210 @@
1
  <?php
2
  /**
3
- * This is an auxiliary class to help display the info on your CatList.php instance.
 
4
  * @author fernando@picandocodigo.net
5
  */
6
  require_once 'CatList.php';
7
 
8
  class CatListDisplayer {
9
- private $catlist;
10
- private $params = array();
11
- private $lcp_output;
12
-
13
- public function __construct($atts) {
14
- $this->params = $atts;
15
- $this->catlist = new CatList($atts);
16
- $this->template();
17
- }
18
-
19
- public function display(){
20
- return $this->lcp_output;
21
- }
22
-
23
- /**
24
- * Template code
25
- */
26
- private function template(){
27
- $tplFileName = null;
28
- $possibleTemplates = array(
29
- // File locations lower in list override others
30
- TEMPLATEPATH.'/list-category-posts/'.$this->params['template'].'.php',
31
- STYLESHEETPATH.'/list-category-posts/'.$this->params['template'].'.php'
32
- );
33
-
34
- foreach ($possibleTemplates as $key => $file) {
35
- if ( is_readable($file) ) {
36
- $tplFileName = $file;
37
- }
38
- }
39
- if ( !empty($tplFileName) && is_readable($tplFileName) ) {
40
- require($tplFileName);
41
- }else{
42
- switch($this->params['template']){
43
- case "default":
44
- $this->build_output('ul');
45
- break;
46
- case "div":
47
- $this->build_output('div');
48
- break;
49
- default:
50
- $this->build_output('ul');
51
- break;
52
- }
53
- }
54
- }
55
-
56
- private function build_output($tag){
57
- $this->lcp_output .= $this->get_category_link('strong');
58
- $this->lcp_output .= '<' . $tag;
59
- if (isset($this->params['class'])): $this->lcp_output .= ' class="' . $this->params['class'] . '"'; endif;
60
- $this->lcp_output .= '>';
61
- $inner_tag = ($tag == 'ul') ? 'li' : 'p';
62
- //Posts loop
63
- foreach ($this->catlist->get_categories_posts() as $single):
64
- if ( !post_password_required($single) ){
65
- $this->lcp_output .= $this->lcp_build_post($single, $inner_tag);
66
- }
67
- endforeach;
68
- $this->lcp_output .= '</' . $tag . '>';
69
-
70
- if (!empty($this->params['morelink'])):
71
- $href = 'href="' . get_category_link($this->catlist->get_category_id()) . '"';
72
- $class = "";
73
- if (!empty($this->params['morelink_class'])):
74
- $class = 'class="' . $this->params['morelink_class'] . '" ';
75
- endif;
76
- $readmore = $this->params['morelink'];
77
- $this->lcp_output .= '<a ' . $href . ' ' . $class . ' >' . $readmore . '</a>';
78
- endif;
79
-
80
-
81
- }
82
-
83
- /**
84
- * This function should be overriden for template system.
85
- * @param post $single
86
- * @param HTML tag to display $tag
87
- * @return string
88
- */
89
- private function lcp_build_post($single, $tag){
90
- global $post;
91
- $class ='';
92
- if ( $post->ID == $single->ID ):
93
- $class = " class = current ";
94
- endif;
95
- $lcp_display_output = '<'. $tag . $class . '>';
96
- $lcp_display_output .= $this->get_post_title($single, $this->params['title_tag'], $this->params['title_class']);
97
-
98
- $lcp_display_output .= $this->get_comments($single, $this->params['comments_tag'], $this->params['comments_class']) . ' ';
99
-
100
- $lcp_display_output .= $this->get_date($single, $this->params['date_tag'], $this->params['date_class']) . ' ';
101
-
102
- $lcp_display_output .= $this->get_author($single, $this->params['author_tag'], $this->params['author_class']) . ' ';
103
-
104
- if (isset($this->params['customfield_display'])){
105
- $lcp_display_output .= $this->get_custom_fields($this->params['customfield_display'], $single->ID);
106
- }
107
-
108
- $lcp_display_output .= $this->get_thumbnail($single);
109
-
110
- $lcp_display_output .= $this->get_content($single, $this->params['content_tag'], $this->params['content_class']);
111
-
112
- $lcp_display_output .= $this->get_excerpt($single, $this->params['excerpt_tag'], $this->params['excerpt_class']);;
113
-
114
- $lcp_display_output .= '</' . $tag . '>';
115
-
116
- return $lcp_display_output;
117
- }
118
-
119
- /**
120
- * Auxiliary functions for templates
121
- */
122
- private function get_author($single, $tag = null, $css_class = null){
123
- $info = $this->catlist->get_author_to_show($single);
124
- return $this->assign_style($info, $tag, $css_class);
125
- }
126
-
127
- private function get_comments($single, $tag = null, $css_class = null){
128
- $info = $this->catlist->get_comments_count($single);
129
- return $this->assign_style($info, $tag, $css_class);
130
- }
131
-
132
- private function get_content($single, $tag = null, $css_class = null){
133
- $info = $this->catlist->get_content($single);
134
- return $this->assign_style($info, $tag, $css_class);
135
- }
136
-
137
- private function get_custom_fields($custom_key, $post_id, $tag = null, $css_class = null){
138
- $info = $this->catlist->get_custom_fields($custom_key, $post_id);
139
- return $this->assign_style($info, $tag, $css_class);
140
- }
141
-
142
- private function get_date($single, $tag = null, $css_class = null){
143
- $info = $this->catlist->get_date_to_show($single);
144
- return $this->assign_style($info, $tag, $css_class);
145
- }
146
-
147
- private function get_excerpt($single, $tag = null, $css_class = null){
148
- $info = $this->catlist->get_excerpt($single);
149
- $info = preg_replace('/\[.*\]/', '', $info);
150
- return $this->assign_style($info, $tag, $css_class);
151
- }
152
-
153
- private function get_thumbnail($single, $tag = null){
154
- if ( isset($this->params['thumbnail_class']) && $this->params['thumbnail_class'] != '' ){
155
- $lcp_thumb_class = $this->params['thumbnail_class'];
156
- $info = $this->catlist->get_thumbnail($single, $lcp_thumb_class);
157
- } else {
158
- $info = $this->catlist->get_thumbnail($single);
159
- }
160
- return $this->assign_style($info, $tag);
161
- }
162
-
163
- private function get_post_title($single, $tag = null, $css_class = null){
164
- $info = '<a href="' . get_permalink($single->ID).'" >' . $single->post_title . '</a>';
165
- return $this->assign_style($info, $tag, $css_class);
166
- }
167
-
168
- private function get_category_link($tag = null, $css_class = null){
169
- $info = $this->catlist->get_category_link();
170
- return $this->assign_style($info, $tag, $css_class);
171
- }
172
-
173
- /**
174
- * Assign style to the info delivered by CatList. Tag is an HTML tag
175
- * which is passed and will sorround the info. Css_class is the css
176
- * class we want to assign to this tag.
177
- * @param string $info
178
- * @param string $tag
179
- * @param string $css_class
180
- * @return string
181
- */
182
- private function assign_style($info, $tag = null, $css_class = null){
183
- if (!empty($info)){
184
- if (empty($tag)){
185
- return $info;
186
- } elseif (!empty($tag) && empty($css_class)) {
187
- return '<' . $tag . '>' . $info . '</' . $tag . '>';
188
- }
189
- return '<' . $tag . ' class="' . $css_class . '">' . $info . '</' . $tag . '>';
190
- }
191
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
192
  }
1
  <?php
2
  /**
3
+ * This is an auxiliary class to help display the info
4
+ * on your CatList.php instance.
5
  * @author fernando@picandocodigo.net
6
  */
7
  require_once 'CatList.php';
8
 
9
  class CatListDisplayer {
10
+ private $catlist;
11
+ private $params = array();
12
+ private $lcp_output;
13
+
14
+ public function __construct($atts) {
15
+ $this->params = $atts;
16
+ $this->catlist = new CatList($atts);
17
+ $this->template();
18
+ }
19
+
20
+ public function display(){
21
+ return $this->lcp_output;
22
+ }
23
+
24
+ /**
25
+ * Template code
26
+ */
27
+ private function template(){
28
+ $tplFileName = null;
29
+ $possibleTemplates = array(
30
+ // File locations lower in list override others
31
+ TEMPLATEPATH.'/list-category-posts/'.$this->params['template'].'.php',
32
+ STYLESHEETPATH.'/list-category-posts/'.$this->params['template'].'.php'
33
+ );
34
+
35
+ foreach ($possibleTemplates as $key => $file) {
36
+ if ( is_readable($file) ) {
37
+ $tplFileName = $file;
38
+ }
39
+ }
40
+ if ( !empty($tplFileName) && is_readable($tplFileName) ) {
41
+ require($tplFileName);
42
+ }else{
43
+ switch($this->params['template']){
44
+ case "default":
45
+ $this->build_output('ul');
46
+ break;
47
+ case "div":
48
+ $this->build_output('div');
49
+ break;
50
+ default:
51
+ $this->build_output('ul');
52
+ break;
53
+ }
54
+ }
55
+ }
56
+
57
+ private function build_output($tag){
58
+ $this->lcp_output .= $this->get_category_link('strong');
59
+ $this->lcp_output .= '<' . $tag;
60
+
61
+ //Give a class to wrapper tag
62
+ if (isset($this->params['class'])):
63
+ $this->lcp_output .= ' class="' . $this->params['class'] . '"';
64
+ endif;
65
+ $this->lcp_output .= '>';
66
+ $inner_tag = ($tag == 'ul') ? 'li' : 'p';
67
+
68
+ //Posts loop
69
+ foreach ($this->catlist->get_categories_posts() as $single){
70
+ if ( !post_password_required($single) ){
71
+ $this->lcp_output .= $this->lcp_build_post($single, $inner_tag);
72
+ }
73
+ }
74
+
75
+ //Close wrapper tag
76
+ $this->lcp_output .= '</' . $tag . '>';
77
+
78
+ if (!empty($this->params['morelink'])):
79
+ $href = 'href="' . get_category_link($this->catlist->get_category_id()) . '"';
80
+ $class = "";
81
+ if (!empty($this->params['morelink_class'])):
82
+ $class = 'class="' . $this->params['morelink_class'] . '" ';
83
+ endif;
84
+ $readmore = $this->params['morelink'];
85
+ $this->lcp_output .= '<a ' . $href . ' ' . $class . ' >' . $readmore . '</a>';
86
+ endif;
87
+ }
88
+
89
+ /**
90
+ * This function should be overriden for template system.
91
+ * @param post $single
92
+ * @param HTML tag to display $tag
93
+ * @return string
94
+ */
95
+ private function lcp_build_post($single, $tag){
96
+ global $post;
97
+ $class ='';
98
+ if ( $post->ID == $single->ID ):
99
+ $class = " class = current ";
100
+ endif;
101
+ $lcp_display_output = '<'. $tag . $class . '>';
102
+ $lcp_display_output .=
103
+ $this->get_post_title($single, $this->params['title_tag'],
104
+ $this->params['title_class']);
105
+ $lcp_display_output .=
106
+ $this->get_comments($single, $this->params['comments_tag'],
107
+ $this->params['comments_class']) . ' ';
108
+
109
+ $lcp_display_output .=
110
+ $this->get_date($single, $this->params['date_tag'],
111
+ $this->params['date_class']) . ' ';
112
+
113
+ $lcp_display_output .=
114
+ $this->get_author($single, $this->params['author_tag'],
115
+ $this->params['author_class']) . ' ';
116
+
117
+ if (isset($this->params['customfield_display'])){
118
+ $lcp_display_output .=
119
+ $this->get_custom_fields($this->params['customfield_display'],
120
+ $single->ID);
121
+ }
122
+
123
+ $lcp_display_output .= $this->get_thumbnail($single);
124
+
125
+ $lcp_display_output .= $this->get_content($single, $this->params['content_tag'], $this->params['content_class']);
126
+
127
+ $lcp_display_output .= $this->get_excerpt($single, $this->params['excerpt_tag'], $this->params['excerpt_class']);;
128
+
129
+ $lcp_display_output .= '</' . $tag . '>';
130
+
131
+ return $lcp_display_output;
132
+ }
133
+
134
+ /**
135
+ * Auxiliary functions for templates
136
+ */
137
+ private function get_author($single, $tag = null, $css_class = null){
138
+ $info = $this->catlist->get_author_to_show($single);
139
+ return $this->assign_style($info, $tag, $css_class);
140
+ }
141
+
142
+ private function get_comments($single, $tag = null, $css_class = null){
143
+ $info = $this->catlist->get_comments_count($single);
144
+ return $this->assign_style($info, $tag, $css_class);
145
+ }
146
+
147
+ private function get_content($single, $tag = null, $css_class = null){
148
+ $info = $this->catlist->get_content($single);
149
+ return $this->assign_style($info, $tag, $css_class);
150
+ }
151
+
152
+ private function get_custom_fields($custom_key, $post_id, $tag = null, $css_class = null){
153
+ $info = $this->catlist->get_custom_fields($custom_key, $post_id);
154
+ return $this->assign_style($info, $tag, $css_class);
155
+ }
156
+
157
+ private function get_date($single, $tag = null, $css_class = null){
158
+ $info = $this->catlist->get_date_to_show($single);
159
+ return $this->assign_style($info, $tag, $css_class);
160
+ }
161
+
162
+ private function get_excerpt($single, $tag = null, $css_class = null){
163
+ $info = $this->catlist->get_excerpt($single);
164
+ $info = preg_replace('/\[.*\]/', '', $info);
165
+ return $this->assign_style($info, $tag, $css_class);
166
+ }
167
+
168
+ private function get_thumbnail($single, $tag = null){
169
+ if ( isset($this->params['thumbnail_class']) &&
170
+ $this->params['thumbnail_class'] != '' ){
171
+ $lcp_thumb_class = $this->params['thumbnail_class'];
172
+ $info = $this->catlist->get_thumbnail($single, $lcp_thumb_class);
173
+ } else {
174
+ $info = $this->catlist->get_thumbnail($single);
175
+ }
176
+ return $this->assign_style($info, $tag);
177
+ }
178
+
179
+ private function get_post_title($single, $tag = null, $css_class = null){
180
+ $info = '<a href="' . get_permalink($single->ID) .
181
+ '" title="'. $single->post_title . '">' .
182
+ $single->post_title . '</a>';
183
+ return $this->assign_style($info, $tag, $css_class);
184
+ }
185
+
186
+ private function get_category_link($tag = null, $css_class = null){
187
+ $info = $this->catlist->get_category_link();
188
+ return $this->assign_style($info, $tag, $css_class);
189
+ }
190
+
191
+ /**
192
+ * Assign style to the info delivered by CatList. Tag is an HTML tag
193
+ * which is passed and will sorround the info. Css_class is the css
194
+ * class we want to assign to this tag.
195
+ * @param string $info
196
+ * @param string $tag
197
+ * @param string $css_class
198
+ * @return string
199
+ */
200
+ private function assign_style($info, $tag = null, $css_class = null){
201
+ if (!empty($info)){
202
+ if (empty($tag)){
203
+ return $info;
204
+ } elseif (!empty($tag) && empty($css_class)) {
205
+ return '<' . $tag . '>' . $info . '</' . $tag . '>';
206
+ }
207
+ return '<' . $tag . ' class="' . $css_class . '">' . $info . '</' . $tag . '>';
208
+ }
209
+ }
210
  }
include/lcp_widget_form.php CHANGED
@@ -3,8 +3,7 @@
3
  * List Category Posts sidebar widget form for Appearance > Widgets.
4
  * @author fernando@picandocodigo.net
5
  */
6
-
7
- $instance = wp_parse_args( (array) $instance, array(
8
  'title' => '',
9
  'categoryid' => '',
10
  'limit' => '',
@@ -18,7 +17,9 @@ $instance = wp_parse_args( (array) $instance, array(
18
  'thumbnail' =>'',
19
  'offset'=>'',
20
  'show_catlink'=>'',
21
- 'morelink' =>'' ) );
 
 
22
  $title = strip_tags($instance['title']);
23
  $limit = strip_tags($instance['limit']);
24
  $orderby = strip_tags($instance['orderby']);
@@ -118,19 +119,19 @@ $morelink = strip_tags($instance['morelink']);
118
  </select>
119
  </p>
120
  <p>
121
- <input type="checkbox" <?php checked( (bool) $instance['show_date'], true ); ?>
122
  name="<?php echo $this->get_field_name( 'show_date' ); ?>" /> <?php _e("Date", 'list-category-posts')?>
123
  </p>
124
  <p>
125
- <input type="checkbox" <?php checked( (bool) $instance['show_author'], true ); ?>
126
  name="<?php echo $this->get_field_name( 'show_author' ); ?>" /> <?php _e("Author", 'list-category-posts')?>
127
  </p>
128
  <p>
129
- <input type="checkbox" <?php checked( (bool) $instance['show_catlink'], true ); ?>
130
  name="<?php echo $this->get_field_name( 'show_catlink' ); ?>" /> <?php _e("Link to category", 'list-category-posts')?>
131
  </p>
132
  <p>
133
- <input type="checkbox" <?php checked( (bool) $instance['show_excerpt'], true ); ?>
134
  name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" /> <?php _e("Excerpt", 'list-category-posts')?>
135
  </p>
136
  <p>
3
  * List Category Posts sidebar widget form for Appearance > Widgets.
4
  * @author fernando@picandocodigo.net
5
  */
6
+ $default = array (
 
7
  'title' => '',
8
  'categoryid' => '',
9
  'limit' => '',
17
  'thumbnail' =>'',
18
  'offset'=>'',
19
  'show_catlink'=>'',
20
+ 'morelink' =>''
21
+ );
22
+ $instance = wp_parse_args( (array) $instance, $default);
23
  $title = strip_tags($instance['title']);
24
  $limit = strip_tags($instance['limit']);
25
  $orderby = strip_tags($instance['orderby']);
119
  </select>
120
  </p>
121
  <p>
122
+ <input class="checkbox" type="checkbox" <?php checked($instance['show_date'], true ); ?>
123
  name="<?php echo $this->get_field_name( 'show_date' ); ?>" /> <?php _e("Date", 'list-category-posts')?>
124
  </p>
125
  <p>
126
+ <input class="checkbox" input type="checkbox" <?php checked($instance['show_author'], true ); ?>
127
  name="<?php echo $this->get_field_name( 'show_author' ); ?>" /> <?php _e("Author", 'list-category-posts')?>
128
  </p>
129
  <p>
130
+ <input class="checkbox" input type="checkbox" <?php checked($instance['show_catlink'], true ); ?>
131
  name="<?php echo $this->get_field_name( 'show_catlink' ); ?>" /> <?php _e("Link to category", 'list-category-posts')?>
132
  </p>
133
  <p>
134
+ <input class="checkbox" input type="checkbox" <?php checked($instance['show_excerpt'], true ); ?>
135
  name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" /> <?php _e("Excerpt", 'list-category-posts')?>
136
  </p>
137
  <p>
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.23.2
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
  */
@@ -61,6 +61,7 @@ class ListCategoryPosts{
61
  'content_tag' => '',
62
  'content_class' => '',
63
  'catlink' => 'no',
 
64
  'catlink_tag' =>'',
65
  'catlink_class' => '',
66
  'comments' => 'no',
@@ -85,7 +86,6 @@ class ListCategoryPosts{
85
 
86
  $catlist_displayer = new CatListDisplayer($atts);
87
  return $catlist_displayer->display();
88
-
89
  }
90
 
91
  }
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.24
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
  */
61
  'content_tag' => '',
62
  'content_class' => '',
63
  'catlink' => 'no',
64
+ 'catlink_string' => '',
65
  'catlink_tag' =>'',
66
  'catlink_class' => '',
67
  'comments' => 'no',
86
 
87
  $catlist_displayer = new CatListDisplayer($atts);
88
  return $catlist_displayer->display();
 
89
  }
90
 
91
  }
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.3.1
7
- Stable tag: 0.23.2
8
 
9
  == Description ==
10
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode.
@@ -15,7 +15,7 @@ The shortcode accepts a category name or id, the order in which you want the pos
15
 
16
  Great to use WordPress as a CMS, and create pages with several categories posts.
17
 
18
- 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
 
@@ -25,19 +25,18 @@ Please, read the information on [Other Notes](http://wordpress.org/extend/plugin
25
 
26
  `[catlist argument1=value1 argument2=value2]`
27
 
28
-
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](http://www.amazon.com/gp/registry/wishlist/2HU1JYOF7DX5Q/ref=wl_web "Amazon Wishlist").
 
 
33
 
34
- **New Code is always welcome** :D
35
- [Fork the plugin on GitHub](https://github.com/picandocodigo/List-Category-Posts).
36
 
37
 
38
  ==Installation==
39
 
40
- * Upload listcat directory into you wp-content/plugins/ directory.
41
  * Login to your WordPress Admin menu, go to Plugins, and activate it.
42
  * You can find the List Category Posts widget in the Appearence > Widgets section on your WordPress Dashboard.
43
  * If you want to customize the way the plugin displays the information, check the section on Templates on this documentation.
@@ -94,13 +93,13 @@ You can use the *categorypage* parameter to make it detect the category id of th
94
 
95
  * **excerpt_size** - Set the number of characters to display from the excerpt. Default is 255. Eg: `excerpt_size = 300`
96
 
97
- * **excludeposts** - IDs of posts to exclude from the list. Ex: [catlist excludeposts=12,52,37]
98
 
99
  * **offset** - You can displace or pass over one or more initial posts which would normally be collected by your query through the use of the offset parameter.
100
 
101
  * **content** - Show the full content of the post. Default is 'no'. Ex: [catlist content=yes]
102
 
103
- * **catlink** - Show the title of the category with a link to the category. Use the template system to customize its display using the variable $cat_link_string. Default is 'no'. Ex: [catlist catlink=yes]. The way it's programmed, it should only display the title for the first category you chose, and include the posts from all of the categories. I thought of this parameter mostly for using several shortcodes on one page or post, so that each group of posts would have the title of that group's category. If you need to display several titles with posts, you should use one [catlist] shortcode for each category you want to display.
104
 
105
  * **comments** - Show comments count for each post. Default is 'no'. Ex: [catlist comments=yes].
106
 
@@ -156,8 +155,9 @@ You can have as many different templates as you want, and use them in different
156
  == Frequently Asked Questions ==
157
  * **Instructions** on how to use the plugin: http://wordpress.org/extend/plugins/list-category-posts/other_notes/
158
  * **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.
159
- * **New feature requests** - Contact me on fernando at picandocodigo dot net.
160
- * **Support** I've decided to use [WordPress Answers](http://wordpress.stackexchange.com/) as the place 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.
 
161
 
162
  * **FAQ**
163
 
@@ -188,6 +188,14 @@ Template system has changed. Custom templates should be stored in WordPress them
188
 
189
  == Changelog ==
190
 
 
 
 
 
 
 
 
 
191
  = 0.23.2 =
192
 
193
  * Bugfix release
4
  Tags: list, categories, posts, cms
5
  Requires at least: 2.8
6
  Tested up to: 3.3.1
7
+ Stable tag: 0.24
8
 
9
  == Description ==
10
  List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode.
15
 
16
  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
 
25
 
26
  `[catlist argument1=value1 argument2=value2]`
27
 
 
 
28
  **Support the plugin**
29
 
30
+ 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) :).
31
+
32
+ **Development**
33
 
34
+ I've moved the development to [GitHub](https://github.com/picandocodigo/List-Category-Posts). Fork it, code, make a pull request, suggest improvements, etc. over there. I dream of the day all of the WordPress plugins will be hosted on Github :)
 
35
 
36
 
37
  ==Installation==
38
 
39
+ * Upload listcat directory into your wp-content/plugins/ directory.
40
  * Login to your WordPress Admin menu, go to Plugins, and activate it.
41
  * You can find the List Category Posts widget in the Appearence > Widgets section on your WordPress Dashboard.
42
  * If you want to customize the way the plugin displays the information, check the section on Templates on this documentation.
93
 
94
  * **excerpt_size** - Set the number of characters to display from the excerpt. Default is 255. Eg: `excerpt_size = 300`
95
 
96
+ * **excludeposts** - IDs of posts to exclude from the list. Use 'this' to exclude the current post. Ex: [catlist excludeposts=this,12,52,37]
97
 
98
  * **offset** - You can displace or pass over one or more initial posts which would normally be collected by your query through the use of the offset parameter.
99
 
100
  * **content** - Show the full content of the post. Default is 'no'. Ex: [catlist content=yes]
101
 
102
+ * **catlink** - Show the title of the category with a link to the category. Use the **catlink_string** option to change the link text. Default is 'no'. Ex: [catlist catlink=yes]. The way it's programmed, it should only display the title for the first category you chose, and include the posts from all of the categories. I thought of this parameter mostly for using several shortcodes on one page or post, so that each group of posts would have the title of that group's category. If you need to display several titles with posts, you should use one [catlist] shortcode for each category you want to display.
103
 
104
  * **comments** - Show comments count for each post. Default is 'no'. Ex: [catlist comments=yes].
105
 
155
  == Frequently Asked Questions ==
156
  * **Instructions** on how to use the plugin: http://wordpress.org/extend/plugins/list-category-posts/other_notes/
157
  * **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.
158
+ * **New feature requests, Bug fixes, enhancements** - You can post them on [GitHub Issues](https://github.com/picandocodigo/List-Category-Posts/issues).
159
+ * **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.
160
+
161
 
162
  * **FAQ**
163
 
188
 
189
  == Changelog ==
190
 
191
+ = 0.24 =
192
+
193
+ * Fixes "excerpt doesn't strip shortcodes" - https://github.com/picandocodigo/List-Category-Posts/issues/5
194
+ * Exclude currently displayed post - [1](http://wordpress.stackexchange.com/questions/44895/exclude-current-page-from-list-of-pages/), [2](https://github.com/picandocodigo/List-Category-Posts/pull/8)
195
+ * Add title to category title [1](http://wordpress.stackexchange.com/questions/44467/list-category-plugin-changing-the-links), will be improved.
196
+ * Attempting to condition whitespaces to WordPress Coding Standard (emacs php-mode sucks for this...)
197
+ * No more git-svn crap, now I'm developing this over at (GitHub)[https://github.com/picandocodigo/List-Category-Posts] and copying it into the WordPress SVN Repo.
198
+
199
  = 0.23.2 =
200
 
201
  * Bugfix release