List category posts - Version 0.73

Version Description

  • Support "and" relationship for custom taxonomies, by Dalton Rooney.
  • Support for multiple taxonomies in the same shortcode by TheSquiffy
  • Tested up to WordPress 4.9
  • Adds Irish translation by Jordan Silaen.
Download this release

Release Info

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

Code changes from version 0.72 to 0.73

include/lcp-catlist.php CHANGED
@@ -117,7 +117,7 @@ class CatList{
117
  if ( is_array($this->lcp_category_id) ){
118
  return array('category__and' => $this->lcp_category_id);
119
  } else {
120
- if($this->utils->lcp_not_empty('child_categories') &&
121
  (($this->params['child_categories'] === 'no' ) ||
122
  ($this->params['child_categories'] === 'false') )){
123
  return array('category__in'=> $this->lcp_category_id);
117
  if ( is_array($this->lcp_category_id) ){
118
  return array('category__and' => $this->lcp_category_id);
119
  } else {
120
+ if($this->utils->lcp_not_empty('child_categories') &&
121
  (($this->params['child_categories'] === 'no' ) ||
122
  ($this->params['child_categories'] === 'false') )){
123
  return array('category__in'=> $this->lcp_category_id);
include/lcp-catlistdisplayer.php CHANGED
@@ -1,592 +1,596 @@
1
- <?php
2
- /**
3
- * This is an auxiliary class to help display the info
4
- * on your CatList instance.
5
- * @author fernando@picandocodigo.net
6
- */
7
- require_once 'lcp-catlist.php';
8
-
9
- class CatListDisplayer {
10
- private $catlist;
11
- private $params = array();
12
- private $lcp_output;
13
-
14
- public static function getTemplatePaths(){
15
- $template_path = TEMPLATEPATH . "/list-category-posts/";
16
- $stylesheet_path = STYLESHEETPATH . "/list-category-posts/";
17
- return array($template_path, $stylesheet_path);
18
- }
19
-
20
- public function __construct($atts) {
21
- $this->params = $atts;
22
- $this->catlist = new CatList($atts);
23
- global $post;
24
- $this->parent = $post;
25
- }
26
-
27
- public function display(){
28
- $this->catlist->save_wp_query();
29
- $this->catlist->get_posts();
30
- $this->select_template();
31
- $this->catlist->restore_wp_query();
32
- wp_reset_query();
33
- return $this->lcp_output;
34
- }
35
-
36
- private function select_template(){
37
- // Check if we got a template param:
38
- if (isset($this->params['template']) &&
39
- !empty($this->params['template'])){
40
- // The default values for ul, ol and div:
41
- if (preg_match('/^ul$|^div$|^ol$/i', $this->params['template'], $matches)){
42
- $this->build_output($matches[0]);
43
- } else {
44
- // Else try an actual template from the params
45
- $this->template();
46
- }
47
- } else {
48
- // Default:
49
- $this->build_output('ul');
50
- }
51
- }
52
-
53
- /**
54
- * Template code
55
- */
56
- private function template(){
57
- $tplFileName = null;
58
- $template_param = $this->params['template'];
59
- $templates = array();
60
-
61
- // Get templates paths and add the incoming parameter to search
62
- // for the php file:
63
- if($template_param){
64
- $paths = self::getTemplatePaths();
65
- foreach($paths as $path){
66
- $templates[] = $path . $template_param . '.php';
67
- }
68
- }
69
-
70
- // Check if we can read the template file:
71
- foreach ($templates as $file) :
72
- if ( is_file($file) && is_readable($file) ) :
73
- $tplFileName = $file;
74
- endif;
75
- endforeach;
76
-
77
- if($tplFileName){
78
- require($tplFileName);
79
- } else {
80
- $this->build_output('ul');
81
- }
82
- }
83
-
84
- public static function get_templates($param = null){
85
- $templates = array();
86
- $paths = self::getTemplatePaths();
87
- foreach ($paths as $templatePath){
88
- if (is_dir($templatePath) && scandir($templatePath)){
89
- foreach (scandir($templatePath) as $file){
90
- // Check that the files found are well formed
91
- if ( ($file[0] != '.') && (substr($file, -4) == '.php') &&
92
- is_file($templatePath.$file) && is_readable($templatePath.$file) ){
93
- $templateName = substr($file, 0, strlen($file)-4);
94
- // Add the template only if necessary
95
- if (!in_array($templateName, $templates)){
96
- $templates[] = $templateName;
97
- }
98
- }
99
- }
100
- }
101
- }
102
- return $templates;
103
- }
104
-
105
- private function build_output($tag){
106
- $this->category_title();
107
-
108
- $this->get_category_description();
109
-
110
- $this->lcp_output .= '<' . $tag;
111
-
112
- // Follow the numner of posts in an ordered list with pagination
113
- if( $tag == 'ol' && $this->catlist->get_page() > 1 ){
114
- $start = $this->catlist->get_number_posts() * ($this->catlist->get_page() - 1) + 1;
115
- $this->lcp_output .= ' start="' . $start . '" ';
116
- }
117
- //Give a class to wrapper tag
118
- if (isset($this->params['class'])):
119
- $this->lcp_output .= ' class="' . $this->params['class'] . '"';
120
- endif;
121
-
122
- //Give id to wrapper tag
123
- if (isset($this->params['instance'])){
124
- $this->lcp_output .= ' id="lcp_instance_' . $this->params['instance'] . '"';
125
- }
126
-
127
- $this->lcp_output .= '>';
128
- $inner_tag = ( ($tag == 'ul') || ($tag == 'ol') ) ? 'li' : 'p';
129
-
130
- $this->lcp_output .= $this->get_conditional_title();
131
-
132
- //Posts loop
133
- global $post;
134
- while ( have_posts() ) : the_post();
135
- if ( !post_password_required($post) ||
136
- ( post_password_required($post) && (
137
- isset($this->params['show_protected']) &&
138
- $this->params['show_protected'] == 'yes' ) )):
139
- $this->lcp_output .= $this->lcp_build_post($post, $inner_tag);
140
- endif;
141
- endwhile;
142
-
143
- if ( ($this->catlist->get_posts_count() == 0) &&
144
- ($this->params["no_posts_text"] != '') ) {
145
- $this->lcp_output .= $this->params["no_posts_text"];
146
- }
147
-
148
- //Close wrapper tag
149
- $this->lcp_output .= '</' . $tag . '>';
150
-
151
- // More link
152
- $this->lcp_output .= $this->get_morelink();
153
-
154
- $this->lcp_output .= $this->get_pagination();
155
- }
156
-
157
- public function get_pagination(){
158
- $pag_output = '';
159
- $lcp_pag_param_present = !empty($this->params['pagination']);
160
- if ($lcp_pag_param_present && $this->params['pagination'] == "yes" ||
161
- # Check if the pagination option is set to true, and the param
162
- # is not set to 'no' (since shortcode parameters should
163
- # override general options.
164
- (get_option('lcp_pagination') === 'true' && ($lcp_pag_param_present && $this->params['pagination'] !== 'false'))):
165
- $lcp_paginator = '';
166
- $number_posts = $this->catlist->get_number_posts();
167
- $pages_count = ceil (
168
- $this->catlist->get_posts_count() /
169
- # Avoid dividing by 0 (pointed out by @rhj4)
170
- max( array( 1, $number_posts ) )
171
- );
172
- if ($pages_count > 1){
173
- for($i = 1; $i <= $pages_count; $i++){
174
- $lcp_paginator .= $this->lcp_page_link($i);
175
- }
176
-
177
- $pag_output .= "<ul class='lcp_paginator'>";
178
-
179
- // Add "Previous" link
180
- if ($this->catlist->get_page() > 1){
181
- $pag_output .= $this->lcp_page_link( intval($this->catlist->get_page()) - 1, $this->params['pagination_prev'] );
182
- }
183
-
184
- $pag_output .= $lcp_paginator;
185
-
186
- // Add "Next" link
187
- if ($this->catlist->get_page() < $pages_count){
188
- $pag_output .= $this->lcp_page_link( intval($this->catlist->get_page()) + 1, $this->params['pagination_next']);
189
- }
190
-
191
- $pag_output .= "</ul>";
192
- }
193
- endif;
194
- return $pag_output;
195
- }
196
-
197
- private function lcp_page_link($page, $char = null){
198
- $current_page = $this->catlist->get_page();
199
- $link = '';
200
-
201
- if ($page == $current_page){
202
- $link = "<li class='lcp_currentpage'>$current_page</li>";
203
- } else {
204
- $request_uri = $_SERVER['REQUEST_URI'];
205
- $query = $_SERVER['QUERY_STRING'];
206
- $amp = ( strpos( $request_uri, "?") ) ? "&" : "";
207
- $pattern = "/[&|?]?lcp_page" . preg_quote($this->catlist->get_instance()) . "=([0-9]+)/";
208
- $query = preg_replace($pattern, '', $query);
209
-
210
- $url = strtok($request_uri,'?');
211
- $protocol = "http";
212
- $port = $_SERVER['SERVER_PORT'];
213
- if ( (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') || $port == 443){
214
- $protocol = "https";
215
- }
216
- $http_host = $_SERVER['HTTP_HOST'];
217
- $page_link = "$protocol://$http_host$url?$query" .
218
- $amp . "lcp_page" . $this->catlist->get_instance() . "=". $page .
219
- "#lcp_instance_" . $this->catlist->get_instance();
220
- $link .= "<li><a href='$page_link' title='$page'>";
221
- ($char != null) ? ($link .= $char) : ($link .= $page);
222
-
223
- $link .= "</a></li>";
224
- }
225
- // WA: Replace '?&' by '?' to avoid potential redirection problems later on
226
- $link = str_replace('?&', '?', $link );
227
- return $link;
228
- }
229
-
230
- /**
231
- * This function should be overriden for template system.
232
- * @param post $single
233
- * @param HTML tag to display $tag
234
- * @return string
235
- */
236
- private function lcp_build_post($single, $tag){
237
- $class ='';
238
- $tag_css = '';
239
- if ( is_object($this->parent) && is_object($single) && $this->parent->ID == $single->ID ){
240
- $class = 'current';
241
- }
242
-
243
- if ( array_key_exists('tags_as_class', $this->params) && $this->params['tags_as_class'] == 'yes' ) {
244
- $post_tags = wp_get_post_Tags($single->ID);
245
- if ( !empty($post_tags) ){
246
- foreach ($post_tags as $post_tag) {
247
- $class .= " $post_tag->slug ";
248
- }
249
- }
250
- }
251
- if ( !empty($class) ){
252
- $tag_css = 'class="' . $class . '"';
253
- }
254
- $lcp_display_output = '<'. $tag . ' ' . $tag_css . '>';
255
-
256
- if ( empty($this->params['no_post_titles']) || !empty($this->params['no_post_titles']) && $this->params['no_post_titles'] !== 'yes' ) {
257
- $lcp_display_output .= $this->get_post_title($single);
258
- }
259
-
260
- // Comments count
261
- $lcp_display_output .= $this->get_stuff_with_tags_and_classes('comments', $single);
262
-
263
- // Date
264
- if (!empty($this->params['date_tag']) || !empty($this->params['date_class'])):
265
- $lcp_display_output .= $this->get_date($single,
266
- $this->params['date_tag'],
267
- $this->params['date_class']);
268
- else:
269
- $lcp_display_output .= $this->get_date($single);
270
- endif;
271
-
272
- // Date Modified
273
- if (!empty($this->params['date_modified_tag']) || !empty($this->params['date_modified_class'])):
274
- $lcp_display_output .= $this->get_modified_date($single,
275
- $this->params['date_modified_tag'],
276
- $this->params['date_modified_class']);
277
- else:
278
- $lcp_display_output .= $this->get_modified_date($single);
279
- endif;
280
-
281
- // Author
282
- $lcp_display_output .= $this->get_stuff_with_tags_and_classes('author', $single);
283
-
284
- // Display ID
285
- if (!empty($this->params['display_id']) && $this->params['display_id'] == 'yes'){
286
- $lcp_display_output .= $single->ID;
287
- }
288
-
289
- // Custom field display
290
- $lcp_display_output .= $this->get_custom_fields($single);
291
-
292
- $lcp_display_output .= $this->get_thumbnail($single);
293
-
294
- $lcp_display_output .= $this->get_stuff_with_tags_and_classes('content', $single);
295
-
296
- $lcp_display_output .= $this->get_stuff_with_tags_and_classes('excerpt', $single);
297
-
298
- $lcp_display_output .= $this->get_posts_morelink($single);
299
-
300
- $lcp_display_output .= '</' . $tag . '>';
301
- return $lcp_display_output;
302
- }
303
-
304
- /**
305
- * Several checks going on here:
306
- * - Tag provided, no class - wrap content with tag
307
- * - Tag and class provided - wrap content with tag and class
308
- * - Class provided, no tag - wrap content with span and class
309
- */
310
- private function get_stuff_with_tags_and_classes($entity, $single){
311
- $result = '';
312
- $stuffFunction = 'get_' . $entity;
313
- if (!empty($this->params[$entity . '_class'])){
314
- if (empty($this->params[$entity . '_tag'])){
315
- $result = $this->$stuffFunction($single, 'span', $this->params[$entity . '_class']);
316
- } else {
317
- $result = $this->$stuffFunction($single, $this->params[$entity . '_tag'], $this->params[$entity . '_class']);
318
- }
319
- } else {
320
- if (!empty($this->params[$entity . '_tag'])){
321
- $result = $this->$stuffFunction($single, $this->params[$entity . '_tag']);
322
- } else {
323
- $result = $this->$stuffFunction($single);
324
- }
325
- }
326
- return $result;
327
- }
328
-
329
- private function category_title(){
330
- // More link
331
- if (!empty($this->params['catlink_tag'])):
332
- if (!empty($this->params['catlink_class'])):
333
- $this->lcp_output .= $this->get_category_link(
334
- $this->params['catlink_tag'],
335
- $this->params['catlink_class']
336
- );
337
- else:
338
- $this->lcp_output .= $this->get_category_link($this->params['catlink_tag']);
339
- endif;
340
- else:
341
- $this->lcp_output .= $this->get_category_link("strong");
342
- endif;
343
- }
344
-
345
- public function get_category_description(){
346
- if(!empty($this->params['category_description']) && $this->params['category_description'] == 'yes'){
347
- $this->lcp_output .= $this->catlist->get_category_description();
348
- }
349
- }
350
-
351
- /**
352
- * Auxiliary functions for templates
353
- */
354
- private function get_comments($single, $tag = null, $css_class = null){
355
- return $this->content_getter('comments', $single, $tag, $css_class);
356
- }
357
-
358
- private function get_author($single, $tag = null, $css_class = null){
359
- return $this->content_getter('author', $single, $tag, $css_class);
360
- }
361
-
362
- private function get_content($single, $tag = null, $css_class = null){
363
- return $this->content_getter('content', $single, $tag, $css_class);
364
- }
365
-
366
- private function get_excerpt($single, $tag = null, $css_class = null){
367
- return $this->content_getter('excerpt', $single, $tag, $css_class);
368
- }
369
-
370
- /*
371
- * These used to be separate functions, now starting to get the code
372
- * in the same function for less repetition.
373
- */
374
- private function content_getter($type, $post, $tag = null, $css_class = null) {
375
- $info = '';
376
- switch( $type ){
377
- case 'comments':
378
- $info = $this->catlist->get_comments_count($post);
379
- break;
380
- case 'author':
381
- $info = $this->catlist->get_author_to_show($post);
382
- break;
383
- case 'content':
384
- $info = $this->catlist->get_content($post);
385
- break;
386
- case 'excerpt':
387
- $info = $this->catlist->get_excerpt($post);
388
- $info = preg_replace('/\[.*\]/', '', $info);
389
- }
390
- return $this->assign_style($info, $tag, $css_class);
391
- }
392
-
393
- private function get_conditional_title(){
394
- if(!empty($this->params['conditional_title_tag']))
395
- $tag = $this->params['conditional_title_tag'];
396
- else
397
- $tag = 'h3';
398
- if(!empty($this->params['conditional_title_class']))
399
- $class = $this->params['conditional_title_class'];
400
- else
401
- $class = '';
402
-
403
- return $this->assign_style($this->catlist->get_conditional_title(), $tag, $class);
404
- }
405
-
406
- private function get_custom_fields($single){
407
- if(!empty($this->params['customfield_display'])){
408
- $info = $this->catlist->get_custom_fields($this->params['customfield_display'], $single->ID);
409
- if(empty($this->params['customfield_tag']) || $this->params['customfield_tag'] == null){
410
- $tag = 'div';
411
- } else {
412
- $tag = $this->params['customfield_tag'];
413
- }
414
-
415
- if(empty($this->params['customfield_class']) || $this->params['customfield_class'] == null){
416
- $css_class = 'lcp_customfield';
417
- } else {
418
- $css_class = $this->params['customfield_class'];
419
- }
420
-
421
- $final_info = '';
422
- if(!is_array($info)){
423
- $final_info = $this->assign_style($info, $tag, $css_class);
424
- }else{
425
- if($this->params['customfield_display_separately'] != 'no'){
426
- foreach($info as $i)
427
- $final_info .= $this->assign_style($i, $tag, $css_class);
428
- }else{
429
- $one_info = implode($this->params['customfield_display_glue'], $info);
430
- $final_info = $this->assign_style($one_info, $tag, $css_class);
431
- }
432
- }
433
- return $final_info;
434
- }
435
- }
436
-
437
- private function get_date($single, $tag = null, $css_class = null){
438
- $info = $this->catlist->get_date_to_show($single);
439
-
440
- if ( !empty($this->params['link_dates']) && ( 'yes' === $this->params['link_dates'] || 'true' === $this->params['link_dates'] ) ):
441
- $info = $this->get_post_link($single, $info);
442
- endif;
443
-
444
- $info = ' ' . $info;
445
- return $this->assign_style($info, $tag, $css_class);
446
- }
447
-
448
- private function get_modified_date($single, $tag = null, $css_class = null){
449
- $info = " " . $this->catlist->get_modified_date_to_show($single);
450
- return $this->assign_style($info, $tag, $css_class);
451
- }
452
-
453
- private function get_thumbnail($single, $tag = null){
454
- if ( !empty($this->params['thumbnail_class']) ) :
455
- $lcp_thumb_class = $this->params['thumbnail_class'];
456
- $info = $this->catlist->get_thumbnail($single, $lcp_thumb_class);
457
- else:
458
- $info = $this->catlist->get_thumbnail($single);
459
- endif;
460
-
461
- return $this->assign_style($info, $tag);
462
- }
463
-
464
- private function get_post_link($single, $text, $class = null){
465
- $info = '<a href="' . get_permalink($single->ID) . '" title="' . wptexturize($single->post_title) . '"';
466
-
467
- if ( !empty($this->params['link_target']) ):
468
- $info .= ' target="' . $this->params['link_target'] . '"';
469
- endif;
470
-
471
- if ( !empty($class ) ):
472
- $info .= ' class="' . $class . '"';
473
- endif;
474
-
475
- $info .= '>' . $text . '</a>';
476
-
477
- return $info;
478
- }
479
-
480
- // Link is a parameter here in case you want to use it on a template
481
- // and not show the links for all the shortcodes using this template:
482
- private function get_post_title($single, $tag = null, $css_class = null, $link = true){
483
- $lcp_post_title = apply_filters('the_title', $single->post_title, $single->ID);
484
-
485
- if ( !empty($this->params['title_limit']) && $this->params['title_limit'] !== "0" ):
486
- $title_limit = intval($this->params['title_limit']);
487
- if( function_exists('mb_strlen') && function_exists('mb_substr') ):
488
- if( mb_strlen($lcp_post_title) > $title_limit ):
489
- $lcp_post_title = mb_substr($lcp_post_title, 0, $title_limit) . "&hellip;";
490
- endif;
491
- else:
492
- if( strlen($lcp_post_title) > $title_limit ):
493
- $lcp_post_title = substr($lcp_post_title, 0, $title_limit) . "&hellip;";
494
- endif;
495
- endif;
496
- endif;
497
-
498
- if (!empty($this->params['title_tag'])){
499
- $pre = "<" . $this->params['title_tag'];
500
- if (!empty($this->params['title_class'])){
501
- $pre .= ' class="' . $this->params['title_class'] . '"';
502
- }
503
- $pre .= '>';
504
- $post = "</" . $this->params['title_tag'] . ">";
505
- }else{
506
- $pre = $post = '';
507
- }
508
-
509
- if ( !$link ||
510
- (!empty($this->params['link_titles']) &&
511
- ( $this->params['link_titles'] === "false" || $this->params['link_titles'] === "no" ) ) ) {
512
- return $pre . $lcp_post_title . $post;
513
- }
514
-
515
- $info = $this->get_post_link($single, $lcp_post_title, (!empty($this->params['title_class']) && empty($this->params['title_tag'])) ? $this->params['title_class'] : null);
516
-
517
- if( !empty($this->params['post_suffix']) ):
518
- $info .= " " . $this->params['post_suffix'];
519
- endif;
520
-
521
- $info = $pre . $info . $post;
522
-
523
- if( $tag !== null || $css_class !== null){
524
- $info = $this->assign_style($info, $tag, $css_class);
525
- }
526
-
527
- return $info;
528
- }
529
-
530
- private function get_posts_morelink($single){
531
- if(!empty($this->params['posts_morelink'])){
532
- $href = 'href="' . get_permalink($single->ID) . '"';
533
- $class = "";
534
- if ( !empty($this->params['posts_morelink_class']) ):
535
- $class = 'class="' . $this->params['posts_morelink_class'] . '" ';
536
- endif;
537
- $readmore = $this->params['posts_morelink'];
538
- return ' <a ' . $href . ' ' . $class . ' >' . $readmore . '</a>';
539
- }
540
- }
541
-
542
- private function get_category_link($tag = null, $css_class = null){
543
- $info = $this->catlist->get_category_link();
544
- return $this->assign_style($info, $tag, $css_class);
545
- }
546
-
547
- private function get_morelink(){
548
- $info = $this->catlist->get_morelink();
549
- if ( !empty($this->params['morelink_tag'])){
550
- if( !empty($this->params['morelink_class']) ){
551
- return "<" . $this->params['morelink_tag'] . " class='" .
552
- $this->params['morelink_class'] . "'>" . $info .
553
- "</" . $this->params["morelink_tag"] . ">";
554
- } else {
555
- return "<" . $this->params['morelink_tag'] . ">" .
556
- $info . "</" . $this->params["morelink_tag"] . ">";
557
- }
558
- } else{
559
- if ( !empty($this->params['morelink_class']) ){
560
- return str_replace("<a", "<a class='" . $this->params['morelink_class'] . "' ", $info);
561
- }
562
- }
563
- return $info;
564
- }
565
-
566
- public function get_category_count(){
567
- return $this->catlist->get_category_count();
568
- }
569
-
570
- /**
571
- * Assign style to the info delivered by CatList. Tag is an HTML tag
572
- * which is passed and will sorround the info. Css_class is the css
573
- * class we want to assign to this tag.
574
- * @param string $info
575
- * @param string $tag
576
- * @param string $css_class
577
- * @return string
578
- */
579
- private function assign_style($info, $tag = null, $css_class = null){
580
- if (!empty($info)):
581
- if (empty($tag) && !empty($css_class)):
582
- $tag = "span";
583
- elseif (empty($tag)):
584
- return $info;
585
- elseif (!empty($tag) && empty($css_class)) :
586
- return '<' . $tag . '>' . $info . '</' . $tag . '>';
587
- endif;
588
- $css_class = sanitize_html_class($css_class);
589
- return '<' . $tag . ' class="' . $css_class . '">' . $info . '</' . $tag . '>';
590
- endif;
591
- }
592
- }
 
 
 
 
1
+ <?php
2
+ /**
3
+ * This is an auxiliary class to help display the info
4
+ * on your CatList instance.
5
+ * @author fernando@picandocodigo.net
6
+ */
7
+ require_once 'lcp-catlist.php';
8
+
9
+ class CatListDisplayer {
10
+ private $catlist;
11
+ private $params = array();
12
+ private $lcp_output;
13
+
14
+ public static function getTemplatePaths(){
15
+ $template_path = TEMPLATEPATH . "/list-category-posts/";
16
+ $stylesheet_path = STYLESHEETPATH . "/list-category-posts/";
17
+ return array($template_path, $stylesheet_path);
18
+ }
19
+
20
+ public function __construct($atts) {
21
+ $this->params = $atts;
22
+ $this->catlist = new CatList($atts);
23
+ global $post;
24
+ $this->parent = $post;
25
+ }
26
+
27
+ public function display(){
28
+ $this->catlist->save_wp_query();
29
+ $this->catlist->get_posts();
30
+ $this->select_template();
31
+ $this->catlist->restore_wp_query();
32
+ wp_reset_query();
33
+ return $this->lcp_output;
34
+ }
35
+
36
+ private function select_template(){
37
+ // Check if we got a template param:
38
+ if (isset($this->params['template']) &&
39
+ !empty($this->params['template'])){
40
+ // The default values for ul, ol and div:
41
+ if (preg_match('/^ul$|^div$|^ol$/i', $this->params['template'], $matches)){
42
+ $this->build_output($matches[0]);
43
+ } else {
44
+ // Else try an actual template from the params
45
+ $this->template();
46
+ }
47
+ } else {
48
+ // Default:
49
+ $this->build_output('ul');
50
+ }
51
+ }
52
+
53
+ /**
54
+ * Template code
55
+ */
56
+ private function template(){
57
+ $tplFileName = null;
58
+ $template_param = $this->params['template'];
59
+ $templates = array();
60
+
61
+ // Get templates paths and add the incoming parameter to search
62
+ // for the php file:
63
+ if($template_param){
64
+ $paths = self::getTemplatePaths();
65
+ foreach($paths as $path){
66
+ $templates[] = $path . $template_param . '.php';
67
+ }
68
+ }
69
+
70
+ // Check if we can read the template file:
71
+ foreach ($templates as $file) :
72
+ if ( is_file($file) && is_readable($file) ) :
73
+ $tplFileName = $file;
74
+ endif;
75
+ endforeach;
76
+
77
+ if($tplFileName){
78
+ require($tplFileName);
79
+ } else {
80
+ $this->build_output('ul');
81
+ }
82
+ }
83
+
84
+ public static function get_templates($param = null){
85
+ $templates = array();
86
+ $paths = self::getTemplatePaths();
87
+ foreach ($paths as $templatePath){
88
+ if (is_dir($templatePath) && scandir($templatePath)){
89
+ foreach (scandir($templatePath) as $file){
90
+ // Check that the files found are well formed
91
+ if ( ($file[0] != '.') && (substr($file, -4) == '.php') &&
92
+ is_file($templatePath.$file) && is_readable($templatePath.$file) ){
93
+ $templateName = substr($file, 0, strlen($file)-4);
94
+ // Add the template only if necessary
95
+ if (!in_array($templateName, $templates)){
96
+ $templates[] = $templateName;
97
+ }
98
+ }
99
+ }
100
+ }
101
+ }
102
+ return $templates;
103
+ }
104
+
105
+ private function build_output($tag){
106
+ $this->category_title();
107
+
108
+ $this->get_category_description();
109
+
110
+ $this->lcp_output .= '<' . $tag;
111
+
112
+ // Follow the numner of posts in an ordered list with pagination
113
+ if( $tag == 'ol' && $this->catlist->get_page() > 1 ){
114
+ $start = $this->catlist->get_number_posts() * ($this->catlist->get_page() - 1) + 1;
115
+ $this->lcp_output .= ' start="' . $start . '" ';
116
+ }
117
+ //Give a class to wrapper tag
118
+ if (isset($this->params['class'])):
119
+ $this->lcp_output .= ' class="' . $this->params['class'] . '"';
120
+ endif;
121
+
122
+ //Give id to wrapper tag
123
+ if (isset($this->params['instance'])){
124
+ $this->lcp_output .= ' id="lcp_instance_' . $this->params['instance'] . '"';
125
+ }
126
+
127
+ $this->lcp_output .= '>';
128
+ $inner_tag = ( ($tag == 'ul') || ($tag == 'ol') ) ? 'li' : 'p';
129
+
130
+ $this->lcp_output .= $this->get_conditional_title();
131
+
132
+ //Posts loop
133
+ global $post;
134
+ while ( have_posts() ) : the_post();
135
+ if ( !post_password_required($post) ||
136
+ ( post_password_required($post) && (
137
+ isset($this->params['show_protected']) &&
138
+ $this->params['show_protected'] == 'yes' ) )):
139
+ $this->lcp_output .= $this->lcp_build_post($post, $inner_tag);
140
+ endif;
141
+ endwhile;
142
+
143
+ if ( ($this->catlist->get_posts_count() == 0) &&
144
+ ($this->params["no_posts_text"] != '') ) {
145
+ $this->lcp_output .= $this->params["no_posts_text"];
146
+ }
147
+
148
+ //Close wrapper tag
149
+ $this->lcp_output .= '</' . $tag . '>';
150
+
151
+ // More link
152
+ $this->lcp_output .= $this->get_morelink();
153
+
154
+ $this->lcp_output .= $this->get_pagination();
155
+ }
156
+
157
+ public function get_pagination(){
158
+ $pag_output = '';
159
+ $lcp_pag_present = !empty($this->params['pagination']);
160
+ if ($lcp_pag_present && $this->params['pagination'] == "yes" ||
161
+ # Check if the pagination option is set to true, and the param
162
+ # is not set to 'no' (since shortcode parameters should
163
+ # override general options.
164
+ (get_option('lcp_pagination') === 'true' && ($lcp_pag_present && $this->params['pagination'] !== 'false'))):
165
+ $lcp_paginator = '';
166
+ $number_posts = $this->catlist->get_number_posts();
167
+ $pages_count = ceil (
168
+ $this->catlist->get_posts_count() /
169
+ # Avoid dividing by 0 (pointed out by @rhj4)
170
+ max( array( 1, $number_posts ) )
171
+ );
172
+ if ($pages_count > 1){
173
+ for($i = 1; $i <= $pages_count; $i++){
174
+ $lcp_paginator .= $this->lcp_page_link($i);
175
+ }
176
+
177
+ $pag_output .= "<ul class='lcp_paginator'>";
178
+
179
+ // Add "Previous" link
180
+ if ($this->catlist->get_page() > 1){
181
+ $pag_output .= $this->lcp_page_link( intval($this->catlist->get_page()) - 1, $this->params['pagination_prev'] );
182
+ }
183
+
184
+ $pag_output .= $lcp_paginator;
185
+
186
+ // Add "Next" link
187
+ if ($this->catlist->get_page() < $pages_count){
188
+ $pag_output .= $this->lcp_page_link( intval($this->catlist->get_page()) + 1, $this->params['pagination_next']);
189
+ }
190
+
191
+ $pag_output .= "</ul>";
192
+ }
193
+ endif;
194
+ return $pag_output;
195
+ }
196
+
197
+ private function lcp_page_link($page, $char = null){
198
+ $current_page = $this->catlist->get_page();
199
+ $link = '';
200
+
201
+ if ($page == $current_page){
202
+ $link = "<li class='lcp_currentpage'>$current_page</li>";
203
+ } else {
204
+ $server_vars = add_magic_quotes($_SERVER);
205
+ $request_uri = $server_vars['REQUEST_URI'];
206
+ $query = $server_vars['QUERY_STRING'];
207
+ $amp = ( strpos( $request_uri, "?") ) ? "&" : "";
208
+ $pattern = "/[&|?]?lcp_page" . preg_quote($this->catlist->get_instance()) . "=([0-9]+)/";
209
+ $query = preg_replace($pattern, '', $query);
210
+
211
+ $url = strtok($request_uri,'?');
212
+ $protocol = "http";
213
+ $port = $server_vars['SERVER_PORT'];
214
+ if ( (!empty($server_vars['HTTPS']) && $server_vars['HTTPS'] !== 'off') || $port == 443){
215
+ $protocol = "https";
216
+ }
217
+ $http_host = $server_vars['HTTP_HOST'];
218
+ $page_link = "$protocol://$http_host$url?$query" .
219
+ $amp . "lcp_page" . $this->catlist->get_instance() . "=". $page .
220
+ "#lcp_instance_" . $this->catlist->get_instance();
221
+ $link .= "<li><a href='$page_link' title='$page'>";
222
+ ($char != null) ? ($link .= $char) : ($link .= $page);
223
+
224
+ $link .= "</a></li>";
225
+ }
226
+ // WA: Replace '?&' by '?' to avoid potential redirection problems later on
227
+ $link = str_replace('?&', '?', $link );
228
+ return $link;
229
+ }
230
+
231
+ /**
232
+ * This function should be overriden for template system.
233
+ * @param post $single
234
+ * @param HTML tag to display $tag
235
+ * @return string
236
+ */
237
+ private function lcp_build_post($single, $tag){
238
+ $class ='';
239
+ $tag_css = '';
240
+ if ( is_object($this->parent) && is_object($single) && $this->parent->ID == $single->ID ){
241
+ $class = 'current';
242
+ }
243
+
244
+ if ( array_key_exists('tags_as_class', $this->params) && $this->params['tags_as_class'] == 'yes' ) {
245
+ $post_tags = wp_get_post_Tags($single->ID);
246
+ if ( !empty($post_tags) ){
247
+ foreach ($post_tags as $post_tag) {
248
+ $class .= " $post_tag->slug ";
249
+ }
250
+ }
251
+ }
252
+ if ( !empty($class) ){
253
+ $tag_css = 'class="' . $class . '"';
254
+ }
255
+ $lcp_display_output = '<'. $tag . ' ' . $tag_css . '>';
256
+
257
+ if ( empty($this->params['no_post_titles']) || !empty($this->params['no_post_titles']) && $this->params['no_post_titles'] !== 'yes' ) {
258
+ $lcp_display_output .= $this->get_post_title($single);
259
+ }
260
+
261
+ // Comments count
262
+ $lcp_display_output .= $this->get_stuff_with_tags_and_classes('comments', $single);
263
+
264
+ // Date
265
+ if (!empty($this->params['date_tag']) || !empty($this->params['date_class'])):
266
+ $lcp_display_output .= $this->get_date($single,
267
+ $this->params['date_tag'],
268
+ $this->params['date_class']);
269
+ else:
270
+ $lcp_display_output .= $this->get_date($single);
271
+ endif;
272
+
273
+ // Date Modified
274
+ if (!empty($this->params['date_modified_tag']) || !empty($this->params['date_modified_class'])):
275
+ $lcp_display_output .= $this->get_modified_date($single,
276
+ $this->params['date_modified_tag'],
277
+ $this->params['date_modified_class']);
278
+ else:
279
+ $lcp_display_output .= $this->get_modified_date($single);
280
+ endif;
281
+
282
+ // Author
283
+ $lcp_display_output .= $this->get_stuff_with_tags_and_classes('author', $single);
284
+
285
+ // Display ID
286
+ if (!empty($this->params['display_id']) && $this->params['display_id'] == 'yes'){
287
+ $lcp_display_output .= $single->ID;
288
+ }
289
+
290
+ // Custom field display
291
+ $lcp_display_output .= $this->get_custom_fields($single);
292
+
293
+ $lcp_display_output .= $this->get_thumbnail($single);
294
+
295
+ $lcp_display_output .= $this->get_stuff_with_tags_and_classes('content', $single);
296
+
297
+ $lcp_display_output .= $this->get_stuff_with_tags_and_classes('excerpt', $single);
298
+
299
+ $lcp_display_output .= $this->get_posts_morelink($single);
300
+
301
+ $lcp_display_output .= '</' . $tag . '>';
302
+ return $lcp_display_output;
303
+ }
304
+
305
+ /**
306
+ * Several checks going on here:
307
+ * - Tag provided, no class - wrap content with tag
308
+ * - Tag and class provided - wrap content with tag and class
309
+ * - Class provided, no tag - wrap content with span and class
310
+ */
311
+ private function get_stuff_with_tags_and_classes($entity, $single){
312
+ $result = '';
313
+ $stuffFunction = 'get_' . $entity;
314
+ if (!empty($this->params[$entity . '_class'])){
315
+ if (empty($this->params[$entity . '_tag'])){
316
+ $result = $this->$stuffFunction($single, 'span', $this->params[$entity . '_class']);
317
+ } else {
318
+ $result = $this->$stuffFunction($single, $this->params[$entity . '_tag'], $this->params[$entity . '_class']);
319
+ }
320
+ } else {
321
+ if (!empty($this->params[$entity . '_tag'])){
322
+ $result = $this->$stuffFunction($single, $this->params[$entity . '_tag']);
323
+ } else {
324
+ $result = $this->$stuffFunction($single);
325
+ }
326
+ }
327
+ return $result;
328
+ }
329
+
330
+ private function category_title(){
331
+ // More link
332
+ if (!empty($this->params['catlink_tag'])):
333
+ if (!empty($this->params['catlink_class'])):
334
+ $this->lcp_output .= $this->get_category_link(
335
+ $this->params['catlink_tag'],
336
+ $this->params['catlink_class']
337
+ );
338
+ else:
339
+ $this->lcp_output .= $this->get_category_link($this->params['catlink_tag']);
340
+ endif;
341
+ else:
342
+ $this->lcp_output .= $this->get_category_link("strong");
343
+ endif;
344
+ }
345
+
346
+ public function get_category_description(){
347
+ if(!empty($this->params['category_description']) && $this->params['category_description'] == 'yes'){
348
+ $this->lcp_output .= $this->catlist->get_category_description();
349
+ }
350
+ }
351
+
352
+ /**
353
+ * Auxiliary functions for templates
354
+ */
355
+ private function get_comments($single, $tag = null, $css_class = null){
356
+ return $this->content_getter('comments', $single, $tag, $css_class);
357
+ }
358
+
359
+ private function get_author($single, $tag = null, $css_class = null){
360
+ return $this->content_getter('author', $single, $tag, $css_class);
361
+ }
362
+
363
+ private function get_content($single, $tag = null, $css_class = null){
364
+ return $this->content_getter('content', $single, $tag, $css_class);
365
+ }
366
+
367
+ private function get_excerpt($single, $tag = null, $css_class = null){
368
+ return $this->content_getter('excerpt', $single, $tag, $css_class);
369
+ }
370
+
371
+ /*
372
+ * These used to be separate functions, now starting to get the code
373
+ * in the same function for less repetition.
374
+ */
375
+ private function content_getter($type, $post, $tag = null, $css_class = null) {
376
+ $info = '';
377
+ switch( $type ){
378
+ case 'comments':
379
+ $info = $this->catlist->get_comments_count($post);
380
+ break;
381
+ case 'author':
382
+ $info = $this->catlist->get_author_to_show($post);
383
+ break;
384
+ case 'content':
385
+ $info = $this->catlist->get_content($post);
386
+ break;
387
+ case 'excerpt':
388
+ $info = $this->catlist->get_excerpt($post);
389
+ $info = preg_replace('/\[.*\]/', '', $info);
390
+ }
391
+ return $this->assign_style($info, $tag, $css_class);
392
+ }
393
+
394
+ private function get_conditional_title(){
395
+ if(!empty($this->params['conditional_title_tag']))
396
+ $tag = $this->params['conditional_title_tag'];
397
+ else
398
+ $tag = 'h3';
399
+ if(!empty($this->params['conditional_title_class']))
400
+ $class = $this->params['conditional_title_class'];
401
+ else
402
+ $class = '';
403
+
404
+ return $this->assign_style($this->catlist->get_conditional_title(), $tag, $class);
405
+ }
406
+
407
+ private function get_custom_fields($single){
408
+ if(!empty($this->params['customfield_display'])){
409
+ $info = $this->catlist->get_custom_fields($this->params['customfield_display'], $single->ID);
410
+ if(empty($this->params['customfield_tag']) || $this->params['customfield_tag'] == null){
411
+ $tag = 'div';
412
+ } else {
413
+ $tag = $this->params['customfield_tag'];
414
+ }
415
+
416
+ if(empty($this->params['customfield_class']) || $this->params['customfield_class'] == null){
417
+ $css_class = 'lcp_customfield';
418
+ } else {
419
+ $css_class = $this->params['customfield_class'];
420
+ }
421
+
422
+ $final_info = '';
423
+ if(!is_array($info)){
424
+ $final_info = $this->assign_style($info, $tag, $css_class);
425
+ }else{
426
+ if($this->params['customfield_display_separately'] != 'no'){
427
+ foreach($info as $i)
428
+ $final_info .= $this->assign_style($i, $tag, $css_class);
429
+ }else{
430
+ $one_info = implode($this->params['customfield_display_glue'], $info);
431
+ $final_info = $this->assign_style($one_info, $tag, $css_class);
432
+ }
433
+ }
434
+ return $final_info;
435
+ }
436
+ }
437
+
438
+ private function get_date($single, $tag = null, $css_class = null){
439
+ $info = $this->catlist->get_date_to_show($single);
440
+
441
+ if ( !empty($this->params['link_dates']) && ( 'yes' === $this->params['link_dates'] || 'true' === $this->params['link_dates'] ) ):
442
+ $info = $this->get_post_link($single, $info);
443
+ endif;
444
+
445
+ $info = ' ' . $info;
446
+ return $this->assign_style($info, $tag, $css_class);
447
+ }
448
+
449
+ private function get_modified_date($single, $tag = null, $css_class = null){
450
+ $info = " " . $this->catlist->get_modified_date_to_show($single);
451
+ return $this->assign_style($info, $tag, $css_class);
452
+ }
453
+
454
+ private function get_thumbnail($single, $tag = null){
455
+ if ( !empty($this->params['thumbnail_class']) ) :
456
+ $lcp_thumb_class = $this->params['thumbnail_class'];
457
+ $info = $this->catlist->get_thumbnail($single, $lcp_thumb_class);
458
+ else:
459
+ $info = $this->catlist->get_thumbnail($single);
460
+ endif;
461
+
462
+ return $this->assign_style($info, $tag);
463
+ }
464
+
465
+ private function get_post_link($single, $text, $class = null){
466
+ $info = '<a href="' . get_permalink($single->ID) . '" title="' . wptexturize($single->post_title) . '"';
467
+
468
+ if ( !empty($this->params['link_target']) ):
469
+ $info .= ' target="' . $this->params['link_target'] . '"';
470
+ endif;
471
+
472
+ if ( !empty($class ) ):
473
+ $info .= ' class="' . $class . '"';
474
+ endif;
475
+
476
+ $info .= '>' . $text . '</a>';
477
+
478
+ return $info;
479
+ }
480
+
481
+ // Link is a parameter here in case you want to use it on a template
482
+ // and not show the links for all the shortcodes using this template:
483
+ private function get_post_title($single, $tag = null, $css_class = null, $link = true){
484
+ $lcp_post_title = apply_filters('the_title', $single->post_title, $single->ID);
485
+
486
+ $lcp_post_title = $this->lcp_title_limit( $lcp_post_title );
487
+
488
+ if ( !empty($this->params['title_tag']) ) {
489
+ $pre = "<" . $this->params['title_tag'];
490
+ if (!empty($this->params['title_class'])){
491
+ $pre .= ' class="' . $this->params['title_class'] . '"';
492
+ }
493
+ $pre .= '>';
494
+ $post = "</" . $this->params['title_tag'] . ">";
495
+ }else{
496
+ $pre = $post = '';
497
+ }
498
+
499
+ if ( !$link || ( !empty($this->params['link_titles'] ) &&
500
+ ( $this->params['link_titles'] === "false" || $this->params['link_titles'] === "no" ) ) ) {
501
+ return $pre . $lcp_post_title . $post;
502
+ }
503
+
504
+ $info = $this->get_post_link($single, $lcp_post_title, (!empty($this->params['title_class']) && empty($this->params['title_tag'])) ? $this->params['title_class'] : null);
505
+
506
+ if( !empty($this->params['post_suffix']) ):
507
+ $info .= " " . $this->params['post_suffix'];
508
+ endif;
509
+
510
+ $info = $pre . $info . $post;
511
+
512
+ if( $tag !== null || $css_class !== null){
513
+ $info = $this->assign_style($info, $tag, $css_class);
514
+ }
515
+
516
+ return $info;
517
+ }
518
+
519
+ // Transform the title into the sub string if `title_limit` is present
520
+ private function lcp_title_limit( $lcp_post_title ){
521
+ if ( !empty($this->params['title_limit']) && $this->params['title_limit'] !== "0" ){
522
+ $title_limit = intval($this->params['title_limit']);
523
+ if( function_exists('mb_strlen') && function_exists('mb_substr') && mb_strlen($lcp_post_title) > $title_limit ){
524
+ $lcp_post_title = mb_substr($lcp_post_title, 0, $title_limit) . "&hellip;";
525
+ } else {
526
+ if( strlen($lcp_post_title) > $title_limit ){
527
+ $lcp_post_title = substr($lcp_post_title, 0, $title_limit) . "&hellip;";
528
+ }
529
+ }
530
+ }
531
+ return $lcp_post_title;
532
+ }
533
+
534
+ private function get_posts_morelink($single){
535
+ if(!empty($this->params['posts_morelink'])){
536
+ $href = 'href="' . get_permalink($single->ID) . '"';
537
+ $class = "";
538
+ if ( !empty($this->params['posts_morelink_class']) ):
539
+ $class = 'class="' . $this->params['posts_morelink_class'] . '" ';
540
+ endif;
541
+ $readmore = $this->params['posts_morelink'];
542
+ return ' <a ' . $href . ' ' . $class . ' >' . $readmore . '</a>';
543
+ }
544
+ }
545
+
546
+ private function get_category_link($tag = null, $css_class = null){
547
+ $info = $this->catlist->get_category_link();
548
+ return $this->assign_style($info, $tag, $css_class);
549
+ }
550
+
551
+ private function get_morelink(){
552
+ $info = $this->catlist->get_morelink();
553
+ if ( !empty($this->params['morelink_tag'])){
554
+ if( !empty($this->params['morelink_class']) ){
555
+ return "<" . $this->params['morelink_tag'] . " class='" .
556
+ $this->params['morelink_class'] . "'>" . $info .
557
+ "</" . $this->params["morelink_tag"] . ">";
558
+ } else {
559
+ return "<" . $this->params['morelink_tag'] . ">" .
560
+ $info . "</" . $this->params["morelink_tag"] . ">";
561
+ }
562
+ } else{
563
+ if ( !empty($this->params['morelink_class']) ){
564
+ return str_replace("<a", "<a class='" . $this->params['morelink_class'] . "' ", $info);
565
+ }
566
+ }
567
+ return $info;
568
+ }
569
+
570
+ public function get_category_count(){
571
+ return $this->catlist->get_category_count();
572
+ }
573
+
574
+ /**
575
+ * Assign style to the info delivered by CatList. Tag is an HTML tag
576
+ * which is passed and will sorround the info. Css_class is the css
577
+ * class we want to assign to this tag.
578
+ * @param string $info
579
+ * @param string $tag
580
+ * @param string $css_class
581
+ * @return string
582
+ */
583
+ private function assign_style($info, $tag = null, $css_class = null){
584
+ if (!empty($info)):
585
+ if (empty($tag) && !empty($css_class)):
586
+ $tag = "span";
587
+ elseif (empty($tag)):
588
+ return $info;
589
+ elseif (!empty($tag) && empty($css_class)) :
590
+ return '<' . $tag . '>' . $info . '</' . $tag . '>';
591
+ endif;
592
+ $css_class = sanitize_html_class($css_class);
593
+ return '<' . $tag . ' class="' . $css_class . '">' . $info . '</' . $tag . '>';
594
+ endif;
595
+ }
596
+ }
include/lcp-parameters.php CHANGED
@@ -1,350 +1,347 @@
1
- <?php
2
- require_once ( LCP_PATH . 'lcp-utils.php' );
3
-
4
- class LcpParameters{
5
- // Singleton implementation
6
- private static $instance = null;
7
- private $starting_with = null;
8
- // $date_query tells us if we need to generate date_query args
9
- private $date_query = false;
10
- private $utils;
11
- private $params;
12
-
13
- public static function get_instance(){
14
- if( !isset( self::$instance ) ){
15
- self::$instance = new self;
16
- }
17
- return self::$instance;
18
- }
19
-
20
- public function get_query_params($params){
21
- $this->params = $params;
22
- # Essential parameters:
23
- $args = array(
24
- 'numberposts' => $params['numberposts'],
25
- 'orderby' => $params['orderby'],
26
- 'order' => $params['order'],
27
- 'offset' => $params['offset']
28
- );
29
-
30
- if( get_option('lcp_orderby') && $params['orderby'] === ''){
31
- $orderby = array('orderby' => get_option('lcp_orderby'));
32
- $args = array_merge($args, $orderby);
33
- }
34
-
35
- if( get_option('lcp_order') && $params['order'] === ''){
36
- $order = array('order' => get_option('lcp_order'));
37
- $args = array_merge($args, $order);
38
- }
39
-
40
- $this->utils = new LcpUtils($params);
41
-
42
- // Check posts to exclude
43
- $args = $this->lcp_check_excludes($args);
44
-
45
- // Check type, status, parent params
46
- $args = $this->lcp_types_and_statuses($args);
47
-
48
- if($this->utils->lcp_not_empty('year')):
49
- $args['year'] = $params['year'];
50
- endif;
51
-
52
- if($this->utils->lcp_not_empty('monthnum')):
53
- $args['monthnum'] = $params['monthnum'];
54
- endif;
55
-
56
- if($this->utils->lcp_not_empty('search')):
57
- $args['s'] = $params['search'];
58
- endif;
59
-
60
- if($this->utils->lcp_not_empty('author_posts')):
61
- $args['author_name'] = $params['author_posts'];
62
- endif;
63
-
64
- // Posts within given date range:
65
- if ( $this->utils->lcp_not_empty('after') ) {
66
- $this->after = $params['after'];
67
- $date_query = true;
68
- }
69
-
70
- if ( $this->utils->lcp_not_empty('after_year') ) {
71
- $this->after_year = $params['after_year'];
72
- $date_query = true;
73
- }
74
-
75
- if ( $this->utils->lcp_not_empty('after_month') ) {
76
- // after_month should be in the range [1, 12]
77
- if ($params['after_month'] >= 1 && $params['after_month'] <= 12) {
78
- $this->after_month = $params['after_month'];
79
- $date_query = true;
80
- }
81
- }
82
-
83
- if ( $this->utils->lcp_not_empty('after_day') ) {
84
- // after_day should be in the range [1, 31]
85
- if ($params['after_day'] >= 1 && $params['after_day'] <= 31) {
86
- $this->after_day = $params['after_day'];
87
- $date_query = true;
88
- }
89
- }
90
-
91
- if ( $this->utils->lcp_not_empty('before') ) {
92
- $this->before = $params['before'];
93
- $date_query = true;
94
- }
95
-
96
- if ( $this->utils->lcp_not_empty('before_year') ) {
97
- $this->before_year = $params['before_year'];
98
- $date_query = true;
99
- }
100
-
101
- if ( $this->utils->lcp_not_empty('before_month') ) {
102
- // before_month should be in the range [1, 12]
103
- if ($params['before_month'] >= 1 && $params['before_month'] <= 12) {
104
- $this->before_month = $params['before_month'];
105
- $date_query = true;
106
- }
107
- }
108
-
109
- if ( $this->utils->lcp_not_empty('before_day') ) {
110
- // before_day should be in the range [1, 31]
111
- if ($params['before_day'] >= 1 && $params['before_day'] <= 31) {
112
- $this->before_day = $params['before_day'];
113
- $date_query = true;
114
- }
115
- }
116
-
117
- // Only generate date_query args if a before/after paramater was found
118
- if (isset($date_query) ){
119
- $args['date_query'] = $this->create_date_query_args();
120
- }
121
-
122
- /*
123
- * Custom fields 'customfield_name' & 'customfield_value'
124
- * should both be defined
125
- */
126
- if( $this->utils->lcp_not_empty('customfield_name') ){
127
- $args['meta_key'] = $params['customfield_name'];
128
- $args['meta_value'] = $params['customfield_value'];
129
- }
130
-
131
- //Get private posts
132
- if( is_user_logged_in() ){
133
- if ( !empty($args['post_status']) ){
134
- $args['post_status'] = array_merge($args['post_status'], array('private'));
135
- } else{
136
- $args['post_status'] = array('private', 'publish');
137
- }
138
- }
139
-
140
- if ( $this->utils->lcp_not_empty('exclude_tags') ){
141
- $args = $this->lcp_excluded_tags($params);
142
- }
143
-
144
- // Current tags
145
- if ( $this->utils->lcp_not_empty('currenttags') && $params['currenttags'] == "yes" ){
146
- $tags = $this->lcp_get_current_tags();
147
- if ( !empty($tags) ){
148
- $args['tag__in'] = $tags;
149
- }
150
- }
151
-
152
- // Custom taxonomy support
153
- // Why didn't I document this?!?
154
- if ( $this->utils->lcp_not_empty('taxonomy') && $this->utils->lcp_not_empty('terms') ){
155
- $args['tax_query'] = array(array(
156
- 'taxonomy' => $params['taxonomy'],
157
- 'field' => 'slug',
158
- 'terms' => explode(",",$params['terms'])
159
- ));
160
- }
161
-
162
- // Tag support
163
- if ( $this->utils->lcp_not_empty('tags') ) {
164
- $args['tag'] = $params['tags'];
165
- }
166
-
167
- if ( !empty($params['exclude'])){
168
- $args['category__not_in'] = array($params['exclude']);
169
- }
170
-
171
- if ( $this->utils->lcp_not_empty('customfield_orderby') ){
172
- $args['orderby'] = 'meta_value';
173
- $args['meta_key'] = $params['customfield_orderby'];
174
- }
175
-
176
- // Posts that start with a given letter:
177
- if ( $this->utils->lcp_not_empty('starting_with') ){
178
- $this->starting_with = $params['starting_with'];
179
- add_filter('posts_where' , array( $this, 'starting_with') );
180
- }
181
-
182
- return $args;
183
- }
184
-
185
- // Check posts to exclude
186
- private function lcp_check_excludes($args){
187
- if( $this->utils->lcp_not_empty('excludeposts') ){
188
- $exclude = array(
189
- 'post__not_in' => explode(",", $this->params['excludeposts'])
190
- );
191
- if (strpos($this->params['excludeposts'], 'this') > -1){
192
- $exclude = array_merge(
193
- $exclude,
194
- array('post__not_in' => array($this->lcp_get_current_post_id() ) )
195
- );
196
- }
197
- $args = array_merge($args, $exclude);
198
- }
199
- return $args;
200
- }
201
-
202
- private function lcp_types_and_statuses($args){
203
- // Post type, status, parent params:
204
- if($this->utils->lcp_not_empty('post_type')):
205
- $args['post_type'] = explode( ',', $this->params['post_type'] );
206
- endif;
207
-
208
- if($this->utils->lcp_not_empty('post_status')):
209
- $args['post_status'] = explode( ',', $this->params['post_status'] );
210
- endif;
211
-
212
- if($this->utils->lcp_not_empty('post_parent')):
213
- $args['post_parent'] = $this->params['post_parent'];
214
- endif;
215
- return $args;
216
- }
217
-
218
- private function lcp_excluded_tags($args){
219
- $excluded_tags = explode(",", $args['exclude_tags']);
220
- $tag_ids = array();
221
- foreach ( $excluded_tags as $excluded){
222
- $tag_ids[] = get_term_by('slug', $excluded, 'post_tag')->term_id;
223
- }
224
- $args['tag__not_in'] = $tag_ids;
225
- return $args;
226
- }
227
-
228
- private function lcp_get_current_tags(){
229
- $tags = get_the_tags();
230
- $tag_ids = array();
231
- if( !empty($tags) ){
232
- foreach ($tags as $tag) {
233
- array_push($tag_ids, $tag->term_id);
234
- }
235
- }
236
- return $tag_ids;
237
- }
238
-
239
- public function starting_with($where){
240
- $letters = explode(',', $this->starting_with);
241
- $where .= 'AND (wp_posts.post_title ' .
242
- 'COLLATE UTF8_GENERAL_CI LIKE \'' . $letters[0] . "%'";
243
- for ($i=1; $i <sizeof($letters); $i++) {
244
- $where .= 'OR wp_posts.post_title ' .
245
- 'COLLATE UTF8_GENERAL_CI LIKE \'' . $letters[$i] . "%'";
246
- }
247
- $where.=')';
248
- return $where;
249
- }
250
-
251
- private function lcp_get_current_post_id(){
252
- global $post;
253
- return $post->ID;
254
- }
255
-
256
- /*
257
- * Create date_query args according to https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters
258
- * There's probably a better way to check if values exist.
259
- * Code should be cleaned up (this is first attempt at a solution).
260
- */
261
- private function create_date_query_args() {
262
- $date_query = array();
263
-
264
- // Keep track of parameters that are set to build the argument array.
265
- $params_set = array(
266
- 'after' => false,
267
- 'after_year' => false,
268
- 'after_month' => false,
269
- 'after_day' => false,
270
- 'before' => false,
271
- 'before_year' => false,
272
- 'before_month' => false,
273
- 'before_day' => false,
274
- );
275
-
276
- // Booleans to track which subarrays should be created.
277
- $after = false;
278
- $before = false;
279
-
280
- /*
281
- * Check which paramaters are set and find out which subarrays
282
- * should be created.
283
- */
284
- if ( isset($this->after) ) {
285
- $params_set['after'] = true;
286
- $after = true;
287
- }
288
-
289
- if ( isset($this->after_year) ) {
290
- $params_set['after_year'] = true;
291
- $after = true;
292
- }
293
-
294
- if ( isset($this->after_month) ) {
295
- $params_set['after_month'] = true;
296
- $after = true;
297
- }
298
-
299
- if ( isset($this->after_day) ) {
300
- $params_set['after_day'] = true;
301
- $after = true;
302
- }
303
-
304
- if ( isset($this->before) ) {
305
- $params_set['before'] = true;
306
- $before = true;
307
- }
308
-
309
- if ( isset($this->before_year) ) {
310
- $params_set['before_year'] = true;
311
- $before = true;
312
- }
313
-
314
- if ( isset($this->before_month) ) {
315
- $params_set['before_month'] = true;
316
- $before = true;
317
- }
318
-
319
- if ( isset($this->before_day) ) {
320
- $params_set['before_day'] = true;
321
- $before = true;
322
- }
323
-
324
- /*
325
- * Build the subarrays.
326
- * The after parameter takes priority over after_* parameters.
327
- * Simlarly, the before parameter takes priority over before_* parameters.
328
- */
329
- if ($after) {
330
- if ($params_set['after']) {
331
- $date_query['after'] = $this->after;
332
- } else {
333
- if ( $params_set['after_year'] ) $date_query['after']['year'] = $this->after_year;
334
- if ( $params_set['after_month'] ) $date_query['after']['month'] = $this->after_month;
335
- if ( $params_set['after_day'] ) $date_query['after']['day'] = $this->after_day;
336
- }
337
- }
338
-
339
- if ($before) {
340
- if ($params_set['before']) {
341
- $date_query['before'] = $this->before;
342
- } else {
343
- if ( $params_set['before_year'] ) $date_query['before']['year'] = $this->before_year;
344
- if ( $params_set['before_month'] ) $date_query['before']['month'] = $this->before_month;
345
- if ( $params_set['before_day'] ) $date_query['before']['day'] = $this->before_day;
346
- }
347
- }
348
- return $date_query;
349
- }
350
- }
1
+ <?php
2
+ require_once ( LCP_PATH . 'lcp-utils.php' );
3
+
4
+ class LcpParameters{
5
+ // Singleton implementation
6
+ private static $instance = null;
7
+ private $starting_with = null;
8
+ // $date_query tells us if we need to generate date_query args
9
+ private $date_query = false;
10
+ private $utils;
11
+ private $params;
12
+
13
+ public static function get_instance(){
14
+ if( !isset( self::$instance ) ){
15
+ self::$instance = new self;
16
+ }
17
+ return self::$instance;
18
+ }
19
+
20
+ public function get_query_params($params){
21
+ $this->params = $params;
22
+ # Essential parameters:
23
+ $args = array(
24
+ 'numberposts' => $params['numberposts'],
25
+ 'orderby' => $params['orderby'],
26
+ 'order' => $params['order'],
27
+ 'offset' => $params['offset']
28
+ );
29
+
30
+ if( get_option('lcp_orderby') && $params['orderby'] === ''){
31
+ $orderby = array('orderby' => get_option('lcp_orderby'));
32
+ $args = array_merge($args, $orderby);
33
+ }
34
+
35
+ if( get_option('lcp_order') && $params['order'] === ''){
36
+ $order = array('order' => get_option('lcp_order'));
37
+ $args = array_merge($args, $order);
38
+ }
39
+
40
+ $this->utils = new LcpUtils($params);
41
+
42
+ // Check posts to exclude
43
+ $args = $this->lcp_check_excludes($args);
44
+
45
+ // Check type, status, parent params
46
+ $args = $this->lcp_types_and_statuses($args);
47
+
48
+ if($this->utils->lcp_not_empty('year')):
49
+ $args['year'] = $params['year'];
50
+ endif;
51
+
52
+ if($this->utils->lcp_not_empty('monthnum')):
53
+ $args['monthnum'] = $params['monthnum'];
54
+ endif;
55
+
56
+ if($this->utils->lcp_not_empty('search')):
57
+ $args['s'] = $params['search'];
58
+ endif;
59
+
60
+ if($this->utils->lcp_not_empty('author_posts')):
61
+ $args['author_name'] = $params['author_posts'];
62
+ endif;
63
+
64
+ // Posts within given date range:
65
+ if ( $this->utils->lcp_not_empty('after') ) {
66
+ $this->after = $params['after'];
67
+ $date_query = true;
68
+ }
69
+
70
+ if ( $this->utils->lcp_not_empty('after_year') ) {
71
+ $this->after_year = $params['after_year'];
72
+ $date_query = true;
73
+ }
74
+
75
+ if ( $this->utils->lcp_not_empty('after_month') ) {
76
+ // after_month should be in the range [1, 12]
77
+ if ($params['after_month'] >= 1 && $params['after_month'] <= 12) {
78
+ $this->after_month = $params['after_month'];
79
+ $date_query = true;
80
+ }
81
+ }
82
+
83
+ if ( $this->utils->lcp_not_empty('after_day') ) {
84
+ // after_day should be in the range [1, 31]
85
+ if ($params['after_day'] >= 1 && $params['after_day'] <= 31) {
86
+ $this->after_day = $params['after_day'];
87
+ $date_query = true;
88
+ }
89
+ }
90
+
91
+ if ( $this->utils->lcp_not_empty('before') ) {
92
+ $this->before = $params['before'];
93
+ $date_query = true;
94
+ }
95
+
96
+ if ( $this->utils->lcp_not_empty('before_year') ) {
97
+ $this->before_year = $params['before_year'];
98
+ $date_query = true;
99
+ }
100
+
101
+ if ( $this->utils->lcp_not_empty('before_month') ) {
102
+ // before_month should be in the range [1, 12]
103
+ if ($params['before_month'] >= 1 && $params['before_month'] <= 12) {
104
+ $this->before_month = $params['before_month'];
105
+ $date_query = true;
106
+ }
107
+ }
108
+
109
+ if ( $this->utils->lcp_not_empty('before_day') ) {
110
+ // before_day should be in the range [1, 31]
111
+ if ($params['before_day'] >= 1 && $params['before_day'] <= 31) {
112
+ $this->before_day = $params['before_day'];
113
+ $date_query = true;
114
+ }
115
+ }
116
+
117
+ // Only generate date_query args if a before/after paramater was found
118
+ if (isset($date_query) ){
119
+ $args['date_query'] = $this->create_date_query_args();
120
+ }
121
+
122
+ /*
123
+ * Custom fields 'customfield_name' & 'customfield_value'
124
+ * should both be defined
125
+ */
126
+ if( $this->utils->lcp_not_empty('customfield_name') ){
127
+ $args['meta_key'] = $params['customfield_name'];
128
+ $args['meta_value'] = $params['customfield_value'];
129
+ }
130
+
131
+ //Get private posts
132
+ if( is_user_logged_in() ){
133
+ if ( !empty($args['post_status']) ){
134
+ $args['post_status'] = array_merge($args['post_status'], array('private'));
135
+ } else{
136
+ $args['post_status'] = array('private', 'publish');
137
+ }
138
+ }
139
+
140
+ if ( $this->utils->lcp_not_empty('exclude_tags') ){
141
+ $args = $this->lcp_excluded_tags($params);
142
+ }
143
+
144
+ // Current tags
145
+ if ( $this->utils->lcp_not_empty('currenttags') && $params['currenttags'] == "yes" ){
146
+ $tags = $this->lcp_get_current_tags();
147
+ if ( !empty($tags) ){
148
+ $args['tag__in'] = $tags;
149
+ }
150
+ }
151
+
152
+ // Custom taxonomy support
153
+ // Why didn't I document this?!?
154
+ if ( $this->utils->lcp_not_empty('taxonomy') && $this->utils->lcp_not_empty('terms') ){
155
+ if ( strpos($params['terms'],'+') !== false ) {
156
+ $terms = explode("+",$params['terms']);
157
+ $operator = 'AND';
158
+ } else {
159
+ $terms = explode(",",$params['terms']);
160
+ $operator = 'IN';
161
+ }
162
+
163
+ $args['tax_query'] = array(array(
164
+ 'taxonomy' => $params['taxonomy'],
165
+ 'field' => 'slug',
166
+ 'terms' => $terms,
167
+ 'operator' => $operator
168
+ ));
169
+ }
170
+
171
+ // Multiple taxonomies support in the form
172
+ // taxonomies_or="tax1:{term1_1,term1_2};tax2:{term2_1,term2_2,term2_3}"
173
+ // taxonomies_and="tax1:{term1_1,term1_2};tax2:{term2_1,term2_2,term2_3}"
174
+ if ( $this->utils->lcp_not_empty('taxonomies_or') || $this->utils->lcp_not_empty('taxonomies_and') ) {
175
+ if($this->utils->lcp_not_empty('taxonomies_or')) {
176
+ $operator = "OR";
177
+ $taxonomies = $params['taxonomies_or'];
178
+ } else {
179
+ $operator = "AND";
180
+ $taxonomies = $params['taxonomies_and'];
181
+ }
182
+ $count = preg_match_all('/([^:]+):\{([^:]+)\}(?:;|$)/im', $taxonomies, $matches, PREG_SET_ORDER, 0);
183
+ if($count > 0) {
184
+ $tax_arr = array('relation' => $operator);
185
+ foreach ($matches as $match) {
186
+ $tax_term = array(
187
+ 'taxonomy' => $match[1],
188
+ 'field' => 'slug',
189
+ 'terms' => explode(",",$match[2])
190
+ );
191
+ array_push($tax_arr,$tax_term);
192
+ }
193
+ $args['tax_query'] = $tax_arr;
194
+ }
195
+ }
196
+
197
+ // Tag support
198
+ if ( $this->utils->lcp_not_empty('tags') ) {
199
+ $args['tag'] = $params['tags'];
200
+ }
201
+
202
+ if ( !empty($params['exclude'])){
203
+ $args['category__not_in'] = array($params['exclude']);
204
+ }
205
+
206
+ if ( $this->utils->lcp_not_empty('customfield_orderby') ){
207
+ $args['orderby'] = 'meta_value';
208
+ $args['meta_key'] = $params['customfield_orderby'];
209
+ }
210
+
211
+ // Posts that start with a given letter:
212
+ if ( $this->utils->lcp_not_empty('starting_with') ){
213
+ $this->starting_with = $params['starting_with'];
214
+ add_filter('posts_where' , array( $this, 'starting_with') );
215
+ }
216
+
217
+ return $args;
218
+ }
219
+
220
+ // Check posts to exclude
221
+ private function lcp_check_excludes($args){
222
+ if( $this->utils->lcp_not_empty('excludeposts') ){
223
+ $exclude = array(
224
+ 'post__not_in' => explode(",", $this->params['excludeposts'])
225
+ );
226
+ if (strpos($this->params['excludeposts'], 'this') > -1){
227
+ $exclude = array_merge(
228
+ $exclude,
229
+ array('post__not_in' => array($this->lcp_get_current_post_id() ) )
230
+ );
231
+ }
232
+ $args = array_merge($args, $exclude);
233
+ }
234
+ return $args;
235
+ }
236
+
237
+ private function lcp_types_and_statuses($args){
238
+ // Post type, status, parent params:
239
+ if($this->utils->lcp_not_empty('post_type')):
240
+ $args['post_type'] = explode( ',', $this->params['post_type'] );
241
+ endif;
242
+
243
+ if($this->utils->lcp_not_empty('post_status')):
244
+ $args['post_status'] = explode( ',', $this->params['post_status'] );
245
+ endif;
246
+
247
+ if($this->utils->lcp_not_empty('post_parent')):
248
+ $args['post_parent'] = $this->params['post_parent'];
249
+ endif;
250
+ return $args;
251
+ }
252
+
253
+ private function lcp_excluded_tags($args){
254
+ $excluded_tags = explode(",", $args['exclude_tags']);
255
+ $tag_ids = array();
256
+ foreach ( $excluded_tags as $excluded){
257
+ $tag_ids[] = get_term_by('slug', $excluded, 'post_tag')->term_id;
258
+ }
259
+ $args['tag__not_in'] = $tag_ids;
260
+ return $args;
261
+ }
262
+
263
+ private function lcp_get_current_tags(){
264
+ $tags = get_the_tags();
265
+ $tag_ids = array();
266
+ if( !empty($tags) ){
267
+ foreach ($tags as $tag) {
268
+ array_push($tag_ids, $tag->term_id);
269
+ }
270
+ }
271
+ return $tag_ids;
272
+ }
273
+
274
+ public function starting_with($where){
275
+ $letters = explode(',', $this->starting_with);
276
+ $where .= 'AND (wp_posts.post_title ' .
277
+ 'COLLATE UTF8_GENERAL_CI LIKE \'' . $letters[0] . "%'";
278
+ for ($i=1; $i <sizeof($letters); $i++) {
279
+ $where .= 'OR wp_posts.post_title ' .
280
+ 'COLLATE UTF8_GENERAL_CI LIKE \'' . $letters[$i] . "%'";
281
+ }
282
+ $where.=')';
283
+ return $where;
284
+ }
285
+
286
+ private function lcp_get_current_post_id(){
287
+ global $post;
288
+ return $post->ID;
289
+ }
290
+
291
+ /*
292
+ * Create date_query args according to https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters
293
+ * There's probably a better way to check if values exist.
294
+ * Code should be cleaned up (this is first attempt at a solution).
295
+ */
296
+ private function create_date_query_args() {
297
+ $date_query = array();
298
+
299
+ // Keep track of parameters that are set to build the argument array.
300
+ $params_set = array(
301
+ 'after' => false,
302
+ 'after_year' => false,
303
+ 'after_month' => false,
304
+ 'after_day' => false,
305
+ 'before' => false,
306
+ 'before_year' => false,
307
+ 'before_month' => false,
308
+ 'before_day' => false,
309
+ );
310
+
311
+ // Booleans to track which subarrays should be created.
312
+ $after = false;
313
+ $before = false;
314
+
315
+ /*
316
+ * Check which paramaters are set and find out which subarrays
317
+ * should be created.
318
+ */
319
+ foreach ($params_set as $key=>$value){
320
+ if ( isset($this->{$key}) ){
321
+ $params_set[$key] = true;
322
+ $trutify = substr($key, 0, strpos( $key, '_') );
323
+ ${$trutify} = true;
324
+ }
325
+ }
326
+
327
+ /*
328
+ * Build the subarrays.
329
+ * The after parameter takes priority over after_* parameters.
330
+ * Similarly, the before parameter takes priority over before_* parameters.
331
+ */
332
+ $time_periods = array('before', 'after');
333
+ foreach ($time_periods as $period){
334
+ if (${$period}){
335
+ if ($params_set[$period]) {
336
+ $date_query[$period] = $this->$period;
337
+ } else {
338
+ if ( $params_set[$period . '_year'] ) $date_query[$period]['year'] = $this->{$period . '_year'};
339
+ if ( $params_set[$period . '_month'] ) $date_query[$period]['month'] = $this->{$period . '_month'};
340
+ if ( $params_set[$period . '_day'] ) $date_query[$period]['day'] = $this->{$period . '_day'};
341
+ }
342
+ }
343
+ }
344
+
345
+ return $date_query;
346
+ }
347
+ }
 
 
 
include/lcp-widget-form.php CHANGED
@@ -1,269 +1,269 @@
1
- <?php
2
- /**
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' => '',
10
- 'orderby'=>'',
11
- 'order'=>'',
12
- 'show_date'=>'',
13
- 'show_modified_date'=>'',
14
- 'show_author'=>'',
15
- 'show_excerpt'=>'',
16
- 'excerpt_size' =>'',
17
- 'exclude'=>'',
18
- 'excludeposts'=>'',
19
- 'thumbnail' =>'',
20
- 'thumbnail_size' =>'',
21
- 'offset'=>'',
22
- 'show_catlink'=>'',
23
- 'morelink' =>'',
24
- 'tags_as_class' => '',
25
- 'template' => '',
26
- );
27
- $instance = wp_parse_args( (array) $instance, $default);
28
-
29
- $title = strip_tags($instance['title']);
30
- $limit = strip_tags($instance['limit']);
31
- $orderby = strip_tags($instance['orderby']);
32
- $order = strip_tags($instance['order']);
33
- $showdate = strip_tags($instance['show_date']);
34
- $showmodifieddate = strip_tags($instance['show_modified_date']);
35
- $showauthor = strip_tags($instance['show_author']);
36
- $exclude = strip_tags($instance['exclude']);
37
- $excludeposts = strip_tags($instance['excludeposts']);
38
- $offset = strip_tags($instance['offset']);
39
- $showcatlink = strip_tags($instance['show_catlink']);
40
- $categoryid = strip_tags($instance['categoryid']);
41
- $showexcerpt = strip_tags($instance['show_excerpt']);
42
- $excerptsize = strip_tags($instance['excerpt_size']);
43
- $thumbnail = strip_tags($instance['thumbnail']);
44
- $thumbnail_size = strip_tags($instance['thumbnail_size']);
45
- $morelink = strip_tags($instance['morelink']);
46
- $tags_as_class = strip_tags($instance['tags_as_class']);
47
- $template = strip_tags($instance['template']);
48
-
49
- ?>
50
-
51
- <p>
52
- <label for="<?php echo $this->get_field_id('title'); ?>">
53
- <?php _e("Title", 'list-category-posts')?>
54
- </label>
55
- <br/>
56
- <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
57
- name="<?php echo $this->get_field_name('title'); ?>" type="text"
58
- value="<?php echo esc_attr($title); ?>" />
59
- </p>
60
-
61
- <p>
62
- <label for="<?php echo $this->get_field_id('categoryid'); ?>">
63
- <?php _e("Category", 'list-category-posts')?>
64
- </label>
65
- <br/>
66
- <select id="<?php echo $this->get_field_id('categoryid'); ?>" name="<?php echo $this->get_field_name('categoryid'); ?>">
67
- <?php
68
- $categories= get_categories();
69
- $option = '<option value="-1"';
70
- if ($categoryid == -1) :
71
- $option .= ' selected = "selected" ';
72
- endif;
73
- $option .= '">' . "Current category" . '</option>';
74
- echo $option;
75
-
76
- foreach ($categories as $cat) :
77
- $option = '<option value="' . $cat->cat_ID . '" ';
78
- if ($cat->cat_ID == $categoryid) :
79
- $option .= ' selected = "selected" ';
80
- endif;
81
- $option .= '">';
82
- $option .= $cat->cat_name;
83
- $option .= '</option>';
84
- echo $option;
85
- endforeach;
86
- ?>
87
- </select>
88
- </p>
89
-
90
- <p>
91
- <label for="<?php echo $this->get_field_id('limit'); ?>">
92
- <?php _e("Number of posts", 'list-category-posts')?>
93
- </label>
94
- <br/>
95
- <input size="2" id="<?php echo $this->get_field_id('limit'); ?>"
96
- name="<?php echo $this->get_field_name('limit'); ?>" type="text"
97
- value="<?php echo esc_attr($limit); ?>" />
98
- </p>
99
-
100
- <p>
101
- <label for="<?php echo $this->get_field_id('offset'); ?>">
102
- <?php _e("Offset", 'list-category-posts')?>: <br/>
103
- <input size="2" id="<?php echo $this->get_field_id('offset'); ?>"
104
- name="<?php echo $this->get_field_name('offset'); ?>" type="text"
105
- value="<?php echo esc_attr($offset); ?>" />
106
- </label>
107
- </p>
108
-
109
- <p>
110
- <label for="<?php echo $this->get_field_id('orderby'); ?>">
111
- <?php _e("Order by", 'list-category-posts')?>
112
- </label> <br/>
113
- <select id="<?php echo $this->get_field_id('orderby'); ?>"
114
- name="<?php echo $this->get_field_name('orderby'); ?>" type="text" >
115
- <?php $lcp_orders = array("date" => __("Date", "list-category-posts"),
116
- "modified" => __("Modified Date", "list-category-posts"),
117
- "title" => __("Post title", "list-category-posts"),
118
- "author" => __("Author", "list-category-posts"),
119
- "rand" => __("Random", "list-category-posts"));
120
- foreach ($lcp_orders as $key=>$value):
121
- $option = '<option value="' . $key . '" ';
122
- if ($orderby == $key):
123
- $option .= ' selected = "selected" ';
124
- endif;
125
- $option .= '>';
126
- echo $option;
127
- _e($value, 'list-category-posts');
128
- echo '</option>';
129
- endforeach;
130
- ?>
131
- </select>
132
- </p>
133
-
134
- <p>
135
- <label for="<?php echo $this->get_field_id('order'); ?>">
136
- <?php _e("Order", 'list-category-posts')?>
137
- </label>
138
- <br/>
139
- <select id="<?php echo $this->get_field_id('order'); ?>"
140
- name="<?php echo $this->get_field_name('order'); ?>" type="text">
141
- <option value='desc' <?php if($order == 'desc'): echo "selected: selected"; endif;?>>
142
- <?php _e("Descending", 'list-category-posts')?>
143
- </option>
144
- <option value='asc' <?php if($order == 'asc'): echo "selected: selected"; endif; ?>>
145
- <?php _e("Ascending", 'list-category-posts')?>
146
- </option>
147
- </select>
148
- </p>
149
-
150
- <p>
151
- <label for="<?php echo $this->get_field_id('exclude'); ?>">
152
- <?php _e("Exclude categories (id's)", 'list-category-posts')?>
153
- </label>
154
- <br/>
155
- <input id="<?php echo $this->get_field_id('exclude'); ?>"
156
- name="<?php echo $this->get_field_name('exclude'); ?>" type="text"
157
- value="<?php echo esc_attr($exclude); ?>" />
158
- </p>
159
-
160
- <p>
161
- <label for="<?php echo $this->get_field_id('excludeposts'); ?>">
162
- <?php _e("Exclude posts (id's)", 'list-category-posts')?>
163
- </label>
164
- <br/>
165
- <input id="<?php echo $this->get_field_id('excludeposts'); ?>"
166
- name="<?php echo $this->get_field_name('excludeposts'); ?>" type="text"
167
- value="<?php echo esc_attr($excludeposts); ?>" />
168
- </p>
169
-
170
- <p>
171
- <?php $image_sizes = get_intermediate_image_sizes() ?>
172
- <label><?php _e("Show", 'list-category-posts')?>: </label><br/>
173
- <input type="checkbox" <?php checked( (bool) $instance['thumbnail'], true ); ?>
174
- name="<?php echo $this->get_field_name( 'thumbnail'); ?>" /> <?php _e("Thumbnail - size", 'list-category-posts')?>
175
- <select id="<?php echo $this->get_field_id('thumbnail_size'); ?>"
176
- name="<?php echo $this->get_field_name( 'thumbnail_size' ); ?>" type="text">
177
- <?php foreach($image_sizes as $image_size) { ?>
178
- <option value='<?php echo $image_size ?>' <?php
179
- if($thumbnail_size == $image_size) echo 'selected';
180
- ?>><?php echo $image_size ?></option>
181
- <?php } ?>
182
- </select>
183
- </p>
184
-
185
- <p>
186
- <input class="checkbox" type="checkbox"
187
- <?php checked( (bool) $instance['show_date'], true ); ?>
188
- name="<?php echo $this->get_field_name( 'show_date' ); ?>" />
189
- <?php _e("Date", 'list-category-posts')?>
190
- </p>
191
- <p>
192
- <input class="checkbox" type="checkbox"
193
- <?php checked( (bool) $instance['show_modified_date'], true ); ?>
194
- name="<?php echo $this->get_field_name( 'show_modified_date' ); ?>" />
195
- <?php _e("Modified Date", 'list-category-posts')?>
196
- </p>
197
- <p>
198
- <input class="checkbox" input type="checkbox"
199
- <?php checked( (bool) $instance['show_author'], true ); ?>
200
- name="<?php echo $this->get_field_name( 'show_author' ); ?>" />
201
- <?php _e("Author", 'list-category-posts')?>
202
- </p>
203
- <p>
204
- <input class="checkbox" input type="checkbox"
205
- <?php checked( (bool) $instance['show_catlink'], true ); ?>
206
- name="<?php echo $this->get_field_name( 'show_catlink' ); ?>" />
207
- <?php _e("Link to category (use 'catlink' on the title field if you want the title of this widget to be a link to the category)", 'list-category-posts')?>
208
- </p>
209
- <p>
210
- <input class="checkbox" input type="checkbox"
211
- <?php checked( (bool) $instance['show_excerpt'], true ); ?>
212
- name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" />
213
- <?php _e("Excerpt", 'list-category-posts')?>
214
- </p>
215
- <p>
216
- <label for="<?php echo $this->get_field_id('excerpt_size'); ?>">
217
- <?php _e("Excerpt size", 'list-category-posts')?>:
218
- </label>
219
- <br/>
220
- <input class="widefat" id="<?php echo $this->get_field_id('excerpt_size'); ?>"
221
- name="<?php echo $this->get_field_name('excerpt_size'); ?>" type="text"
222
- value="<?php echo esc_attr($excerptsize); ?>" />
223
- </p>
224
- <p>
225
- <label for="<?php echo $this->get_field_id('morelink'); ?>">
226
- <?php _e("More link", 'list-category-posts')?>:
227
- </label>
228
- <br/>
229
- <input class="widefat" id="<?php echo $this->get_field_id('morelink'); ?>"
230
- name="<?php echo $this->get_field_name('morelink'); ?>" type="text"
231
- value="<?php echo esc_attr($morelink); ?>" />
232
- </p>
233
- <p>
234
- <label for="<?php echo $this->get_field_id('tags_as_class'); ?>">
235
- <?php _e("Tags as class", 'list-category-posts'); ?>:
236
- </label>
237
- <br/>
238
- <select id="<?php echo $this->get_field_id('tags_as_class'); ?>" name="<?php echo $this->get_field_name('tags_as_class'); ?>" type="text">
239
- <option value='no' <?php if($tags_as_class == 'no'): echo "selected: selected"; endif;?>>
240
- <?php _e("No", 'list-category-posts')?>
241
- </option>
242
- <option value='yes' <?php if($tags_as_class == 'yes'): echo "selected: selected"; endif;?>>
243
- <?php _e("Yes", 'list-category-posts')?>
244
- </option>
245
- </select>
246
- </p>
247
-
248
- <p>
249
- <label for="<?php echo $this->get_field_id('template'); ?>">
250
- <?php _e("Template", 'list-category-posts')?>:
251
- </label>
252
- <br/>
253
- <select id="<?php echo $this->get_field_id('template'); ?>" name="<?php echo $this->get_field_name('template'); ?>">
254
- <?php
255
- $templates = CatListDisplayer::get_templates();
256
- $templates[] = 'default';
257
- foreach ($templates as $tmp) :
258
- $option = '<option value="' . $tmp . '" ';
259
- if ($tmp == $template) :
260
- $option .= ' selected = "selected" ';
261
- endif;
262
- $option .= '">';
263
- $option .= $tmp;
264
- $option .= '</option>';
265
- echo $option;
266
- endforeach;
267
- ?>
268
- </select>
269
- </p>
1
+ <?php
2
+ /**
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' => '',
10
+ 'orderby'=>'',
11
+ 'order'=>'',
12
+ 'show_date'=>'',
13
+ 'show_modified_date'=>'',
14
+ 'show_author'=>'',
15
+ 'show_excerpt'=>'',
16
+ 'excerpt_size' =>'',
17
+ 'exclude'=>'',
18
+ 'excludeposts'=>'',
19
+ 'thumbnail' =>'',
20
+ 'thumbnail_size' =>'',
21
+ 'offset'=>'',
22
+ 'show_catlink'=>'',
23
+ 'morelink' =>'',
24
+ 'tags_as_class' => '',
25
+ 'template' => '',
26
+ );
27
+ $instance = wp_parse_args( (array) $instance, $default);
28
+
29
+ $title = strip_tags($instance['title']);
30
+ $limit = strip_tags($instance['limit']);
31
+ $orderby = strip_tags($instance['orderby']);
32
+ $order = strip_tags($instance['order']);
33
+ $showdate = strip_tags($instance['show_date']);
34
+ $showmodifieddate = strip_tags($instance['show_modified_date']);
35
+ $showauthor = strip_tags($instance['show_author']);
36
+ $exclude = strip_tags($instance['exclude']);
37
+ $excludeposts = strip_tags($instance['excludeposts']);
38
+ $offset = strip_tags($instance['offset']);
39
+ $showcatlink = strip_tags($instance['show_catlink']);
40
+ $categoryid = strip_tags($instance['categoryid']);
41
+ $showexcerpt = strip_tags($instance['show_excerpt']);
42
+ $excerptsize = strip_tags($instance['excerpt_size']);
43
+ $thumbnail = strip_tags($instance['thumbnail']);
44
+ $thumbnail_size = strip_tags($instance['thumbnail_size']);
45
+ $morelink = strip_tags($instance['morelink']);
46
+ $tags_as_class = strip_tags($instance['tags_as_class']);
47
+ $template = strip_tags($instance['template']);
48
+
49
+ ?>
50
+
51
+ <p>
52
+ <label for="<?php echo $this->get_field_id('title'); ?>">
53
+ <?php _e("Title", 'list-category-posts')?>
54
+ </label>
55
+ <br/>
56
+ <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
57
+ name="<?php echo $this->get_field_name('title'); ?>" type="text"
58
+ value="<?php echo esc_attr($title); ?>" />
59
+ </p>
60
+
61
+ <p>
62
+ <label for="<?php echo $this->get_field_id('categoryid'); ?>">
63
+ <?php _e("Category", 'list-category-posts')?>
64
+ </label>
65
+ <br/>
66
+ <select id="<?php echo $this->get_field_id('categoryid'); ?>" name="<?php echo $this->get_field_name('categoryid'); ?>">
67
+ <?php
68
+ $categories= get_categories();
69
+ $option = '<option value="-1"';
70
+ if ($categoryid == -1) :
71
+ $option .= ' selected = "selected" ';
72
+ endif;
73
+ $option .= '">' . "Current category" . '</option>';
74
+ echo $option;
75
+
76
+ foreach ($categories as $cat) :
77
+ $option = '<option value="' . $cat->cat_ID . '" ';
78
+ if ($cat->cat_ID == $categoryid) :
79
+ $option .= ' selected = "selected" ';
80
+ endif;
81
+ $option .= '">';
82
+ $option .= $cat->cat_name;
83
+ $option .= '</option>';
84
+ echo $option;
85
+ endforeach;
86
+ ?>
87
+ </select>
88
+ </p>
89
+
90
+ <p>
91
+ <label for="<?php echo $this->get_field_id('limit'); ?>">
92
+ <?php _e("Number of posts", 'list-category-posts')?>
93
+ </label>
94
+ <br/>
95
+ <input size="2" id="<?php echo $this->get_field_id('limit'); ?>"
96
+ name="<?php echo $this->get_field_name('limit'); ?>" type="text"
97
+ value="<?php echo esc_attr($limit); ?>" />
98
+ </p>
99
+
100
+ <p>
101
+ <label for="<?php echo $this->get_field_id('offset'); ?>">
102
+ <?php _e("Offset", 'list-category-posts')?>: <br/>
103
+ <input size="2" id="<?php echo $this->get_field_id('offset'); ?>"
104
+ name="<?php echo $this->get_field_name('offset'); ?>" type="text"
105
+ value="<?php echo esc_attr($offset); ?>" />
106
+ </label>
107
+ </p>
108
+
109
+ <p>
110
+ <label for="<?php echo $this->get_field_id('orderby'); ?>">
111
+ <?php _e("Order by", 'list-category-posts')?>
112
+ </label> <br/>
113
+ <select id="<?php echo $this->get_field_id('orderby'); ?>"
114
+ name="<?php echo $this->get_field_name('orderby'); ?>" type="text" >
115
+ <?php $lcp_orders = array("date" => __("Date", "list-category-posts"),
116
+ "modified" => __("Modified Date", "list-category-posts"),
117
+ "title" => __("Post title", "list-category-posts"),
118
+ "author" => __("Author", "list-category-posts"),
119
+ "rand" => __("Random", "list-category-posts"));
120
+ foreach ($lcp_orders as $key=>$value):
121
+ $option = '<option value="' . $key . '" ';
122
+ if ($orderby == $key):
123
+ $option .= ' selected = "selected" ';
124
+ endif;
125
+ $option .= '>';
126
+ echo $option;
127
+ _e($value, 'list-category-posts');
128
+ echo '</option>';
129
+ endforeach;
130
+ ?>
131
+ </select>
132
+ </p>
133
+
134
+ <p>
135
+ <label for="<?php echo $this->get_field_id('order'); ?>">
136
+ <?php _e("Order", 'list-category-posts')?>
137
+ </label>
138
+ <br/>
139
+ <select id="<?php echo $this->get_field_id('order'); ?>"
140
+ name="<?php echo $this->get_field_name('order'); ?>" type="text">
141
+ <option value='desc' <?php if($order == 'desc'): echo "selected: selected"; endif;?>>
142
+ <?php _e("Descending", 'list-category-posts')?>
143
+ </option>
144
+ <option value='asc' <?php if($order == 'asc'): echo "selected: selected"; endif; ?>>
145
+ <?php _e("Ascending", 'list-category-posts')?>
146
+ </option>
147
+ </select>
148
+ </p>
149
+
150
+ <p>
151
+ <label for="<?php echo $this->get_field_id('exclude'); ?>">
152
+ <?php _e("Exclude categories (id's)", 'list-category-posts')?>
153
+ </label>
154
+ <br/>
155
+ <input id="<?php echo $this->get_field_id('exclude'); ?>"
156
+ name="<?php echo $this->get_field_name('exclude'); ?>" type="text"
157
+ value="<?php echo esc_attr($exclude); ?>" />
158
+ </p>
159
+
160
+ <p>
161
+ <label for="<?php echo $this->get_field_id('excludeposts'); ?>">
162
+ <?php _e("Exclude posts (id's)", 'list-category-posts')?>
163
+ </label>
164
+ <br/>
165
+ <input id="<?php echo $this->get_field_id('excludeposts'); ?>"
166
+ name="<?php echo $this->get_field_name('excludeposts'); ?>" type="text"
167
+ value="<?php echo esc_attr($excludeposts); ?>" />
168
+ </p>
169
+
170
+ <p>
171
+ <?php $image_sizes = get_intermediate_image_sizes() ?>
172
+ <label><?php _e("Show", 'list-category-posts')?>: </label><br/>
173
+ <input type="checkbox" <?php checked( (bool) $instance['thumbnail'], true ); ?>
174
+ name="<?php echo $this->get_field_name( 'thumbnail'); ?>" /> <?php _e("Thumbnail - size", 'list-category-posts')?>
175
+ <select id="<?php echo $this->get_field_id('thumbnail_size'); ?>"
176
+ name="<?php echo $this->get_field_name( 'thumbnail_size' ); ?>" type="text">
177
+ <?php foreach($image_sizes as $image_size) { ?>
178
+ <option value='<?php echo $image_size ?>' <?php
179
+ if($thumbnail_size == $image_size) echo 'selected';
180
+ ?>><?php echo $image_size ?></option>
181
+ <?php } ?>
182
+ </select>
183
+ </p>
184
+
185
+ <p>
186
+ <input class="checkbox" type="checkbox"
187
+ <?php checked( (bool) $instance['show_date'], true ); ?>
188
+ name="<?php echo $this->get_field_name( 'show_date' ); ?>" />
189
+ <?php _e("Date", 'list-category-posts')?>
190
+ </p>
191
+ <p>
192
+ <input class="checkbox" type="checkbox"
193
+ <?php checked( (bool) $instance['show_modified_date'], true ); ?>
194
+ name="<?php echo $this->get_field_name( 'show_modified_date' ); ?>" />
195
+ <?php _e("Modified Date", 'list-category-posts')?>
196
+ </p>
197
+ <p>
198
+ <input class="checkbox" input type="checkbox"
199
+ <?php checked( (bool) $instance['show_author'], true ); ?>
200
+ name="<?php echo $this->get_field_name( 'show_author' ); ?>" />
201
+ <?php _e("Author", 'list-category-posts')?>
202
+ </p>
203
+ <p>
204
+ <input class="checkbox" input type="checkbox"
205
+ <?php checked( (bool) $instance['show_catlink'], true ); ?>
206
+ name="<?php echo $this->get_field_name( 'show_catlink' ); ?>" />
207
+ <?php _e("Link to category (use 'catlink' on the title field if you want the title of this widget to be a link to the category)", 'list-category-posts')?>
208
+ </p>
209
+ <p>
210
+ <input class="checkbox" input type="checkbox"
211
+ <?php checked( (bool) $instance['show_excerpt'], true ); ?>
212
+ name="<?php echo $this->get_field_name( 'show_excerpt' ); ?>" />
213
+ <?php _e("Excerpt", 'list-category-posts')?>
214
+ </p>
215
+ <p>
216
+ <label for="<?php echo $this->get_field_id('excerpt_size'); ?>">
217
+ <?php _e("Excerpt size", 'list-category-posts')?>:
218
+ </label>
219
+ <br/>
220
+ <input class="widefat" id="<?php echo $this->get_field_id('excerpt_size'); ?>"
221
+ name="<?php echo $this->get_field_name('excerpt_size'); ?>" type="text"
222
+ value="<?php echo esc_attr($excerptsize); ?>" />
223
+ </p>
224
+ <p>
225
+ <label for="<?php echo $this->get_field_id('morelink'); ?>">
226
+ <?php _e("More link", 'list-category-posts')?>:
227
+ </label>
228
+ <br/>
229
+ <input class="widefat" id="<?php echo $this->get_field_id('morelink'); ?>"
230
+ name="<?php echo $this->get_field_name('morelink'); ?>" type="text"
231
+ value="<?php echo esc_attr($morelink); ?>" />
232
+ </p>
233
+ <p>
234
+ <label for="<?php echo $this->get_field_id('tags_as_class'); ?>">
235
+ <?php _e("Tags as class", 'list-category-posts'); ?>:
236
+ </label>
237
+ <br/>
238
+ <select id="<?php echo $this->get_field_id('tags_as_class'); ?>" name="<?php echo $this->get_field_name('tags_as_class'); ?>" type="text">
239
+ <option value='no' <?php if($tags_as_class == 'no'): echo "selected: selected"; endif;?>>
240
+ <?php _e("No", 'list-category-posts')?>
241
+ </option>
242
+ <option value='yes' <?php if($tags_as_class == 'yes'): echo "selected: selected"; endif;?>>
243
+ <?php _e("Yes", 'list-category-posts')?>
244
+ </option>
245
+ </select>
246
+ </p>
247
+
248
+ <p>
249
+ <label for="<?php echo $this->get_field_id('template'); ?>">
250
+ <?php _e("Template", 'list-category-posts')?>:
251
+ </label>
252
+ <br/>
253
+ <select id="<?php echo $this->get_field_id('template'); ?>" name="<?php echo $this->get_field_name('template'); ?>">
254
+ <?php
255
+ $templates = CatListDisplayer::get_templates();
256
+ $templates[] = 'default';
257
+ foreach ($templates as $tmp) :
258
+ $option = '<option value="' . $tmp . '" ';
259
+ if ($tmp == $template) :
260
+ $option .= ' selected = "selected" ';
261
+ endif;
262
+ $option .= '">';
263
+ $option .= $tmp;
264
+ $option .= '</option>';
265
+ echo $option;
266
+ endforeach;
267
+ ?>
268
+ </select>
269
+ </p>
include/lcp-widget.php CHANGED
@@ -1,124 +1,124 @@
1
- <?php
2
- /**
3
- * List Category Posts sidebar widget.
4
- * @author fernando@picandocodigo.net
5
- */
6
- require_once 'lcp-catlistdisplayer.php';
7
-
8
- class ListCategoryPostsWidget extends WP_Widget{
9
-
10
- function __construct() {
11
- $opts = array('description' => __('List posts from a specified category','list-category-posts') );
12
- parent::__construct(false, $name = __('List Category Posts','list-category-posts'), $opts);
13
- }
14
-
15
- function widget($args, $instance) {
16
- global $post;
17
- extract( $args );
18
-
19
- $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
20
- $limit = (is_numeric($instance['limit'])) ? $instance['limit'] : 5;
21
- $orderby = ($instance['orderby']) ? $instance['orderby'] : 'date';
22
- $order = ($instance['order']) ? $instance['order'] : 'desc';
23
- $exclude = ($instance['exclude'] != '') ? $instance['exclude'] : 0;
24
- if($instance['excludeposts'] == 'current')
25
- $excludeposts = $post->ID;
26
- if(!isset($excludeposts))
27
- $excludeposts = ($instance['excludeposts'] != '') ? $instance['excludeposts'] : 0;
28
- $offset = (is_numeric($instance['offset'])) ? $instance['offset'] : 0;
29
- $category_id = $instance['categoryid'];
30
- $dateformat = ($instance['dateformat']) ? $instance['dateformat'] : get_option('date_format');
31
- $showdate = ($instance['show_date'] == 'on') ? 'yes' : 'no';
32
- $showmodifieddate = ($instance['show_modified_date'] == 'on') ? 'yes' : 'no';
33
- $showexcerpt = ($instance['show_excerpt'] == 'on') ? 'yes' : 'no';
34
- $excerptsize = (empty($instance['excerpt_size']) ? 55 : $instance['excerpt_size']);
35
- $showauthor = ($instance['show_author'] == 'on') ? 'yes' : 'no';
36
- $showcatlink = ($instance['show_catlink'] == 'on') ? 'yes' : 'no';
37
- $thumbnail = ($instance['thumbnail'] == 'on') ? 'yes' : 'no';
38
- $thumbnail_size = ($instance['thumbnail_size']) ? $instance['thumbnail_size'] : 'thumbnail';
39
- $morelink = empty($instance['morelink']) ? ' ' : $instance['morelink'];
40
- if ( empty( $instance['tags_as_class'] ) ) {
41
- $instance['tags_as_class'] = 'no';
42
- }
43
- $tags_as_class = ($instance['tags_as_class'] == 'yes') ? 'yes' : 'no';
44
- $template = empty($instance['template']) ? 'default' : $instance['template'];
45
-
46
- $atts = array(
47
- 'id' => $category_id,
48
- 'orderby' => $orderby,
49
- 'order' => $order,
50
- 'numberposts' => $limit,
51
- 'date' => $showdate,
52
- 'date_modified' => $showmodifieddate,
53
- 'author' => $showauthor,
54
- 'dateformat' => $dateformat,
55
- 'template' => 'default',
56
- 'excerpt' => $showexcerpt,
57
- 'excerpt_size' => $excerptsize,
58
- 'exclude' => $exclude,
59
- 'excludeposts' => $excludeposts,
60
- 'offset' => $offset,
61
- 'catlink' => $showcatlink,
62
- 'thumbnail' => $thumbnail,
63
- 'thumbnail_size' => $thumbnail_size,
64
- 'morelink' => $morelink,
65
- 'tags_as_class' => $tags_as_class,
66
- 'template' => $template,
67
- );
68
-
69
- echo $before_widget;
70
-
71
- if ($title == 'catlink') {
72
- // If the user has setup 'catlink' as the title, replace it with
73
- // the category link:
74
- $lcp_category = get_category($category_id);
75
- $title = '<a href="' . get_category_link($lcp_category->cat_ID) . '">' .
76
- $lcp_category->name . '</a>';
77
- } elseif ($title == 'catname') {
78
- // If the user has setup 'catname' as the title, replace it with
79
- // the category link:
80
- $lcp_category = get_the_category($post->ID);
81
- $title = $lcp_category[0]->name;
82
- }
83
- echo $before_title . $title . $after_title;
84
-
85
- $catlist_displayer = new CatListDisplayer($atts);
86
- echo $catlist_displayer->display();
87
- echo $after_widget;
88
- }
89
-
90
- /** @see WP_Widget::update */
91
- function update($new_instance, $old_instance) {
92
- $instance = $old_instance;
93
- $instance['title'] = strip_tags($new_instance['title']);
94
- $instance['limit'] = strip_tags($new_instance['limit']);
95
- $instance['orderby'] = strip_tags($new_instance['orderby']);
96
- $instance['order'] = strip_tags($new_instance['order']);
97
- $instance['exclude'] = strip_tags($new_instance['exclude']);
98
- $instance['excludeposts'] = strip_tags($new_instance['excludeposts']);
99
- $instance['offset'] = strip_tags($new_instance['offset']);
100
- $instance['categoryid'] = strip_tags($new_instance['categoryid']);
101
- $instance['dateformat'] = strip_tags($new_instance['dateformat']);
102
- $instance['show_date'] = strip_tags($new_instance['show_date']);
103
- $instance['show_modified_date'] = strip_tags($new_instance['show_modified_date']);
104
- $instance['show_excerpt'] = strip_tags($new_instance['show_excerpt']);
105
- $instance['excerpt_size'] = strip_tags($new_instance['excerpt_size']);
106
- $instance['show_author'] = strip_tags($new_instance['show_author']);
107
- $instance['show_catlink'] = strip_tags($new_instance['show_catlink']);
108
- $instance['show_catlink'] = strip_tags($new_instance['show_catlink']);
109
- $instance['thumbnail'] = strip_tags($new_instance['thumbnail']);
110
- $instance['thumbnail_size'] = strip_tags($new_instance['thumbnail_size']);
111
- $instance['morelink'] = strip_tags($new_instance['morelink']);
112
- $instance['tags_as_class'] = strip_tags($new_instance['tags_as_class']);
113
- $instance['template'] = strip_tags($new_instance['template']);
114
-
115
- return $instance;
116
- }
117
-
118
- /** @see WP_Widget::form */
119
- function form($instance) {
120
- include('lcp-widget-form.php');
121
- }
122
- }
123
-
124
- add_action('widgets_init', create_function('', 'return register_widget("listCategoryPostsWidget");'));
1
+ <?php
2
+ /**
3
+ * List Category Posts sidebar widget.
4
+ * @author fernando@picandocodigo.net
5
+ */
6
+ require_once 'lcp-catlistdisplayer.php';
7
+
8
+ class ListCategoryPostsWidget extends WP_Widget{
9
+
10
+ function __construct() {
11
+ $opts = array('description' => __('List posts from a specified category','list-category-posts') );
12
+ parent::__construct(false, $name = __('List Category Posts','list-category-posts'), $opts);
13
+ }
14
+
15
+ function widget($args, $instance) {
16
+ global $post;
17
+ extract( $args );
18
+
19
+ $title = empty($instance['title']) ? ' ' : apply_filters('widget_title', $instance['title']);
20
+ $limit = (is_numeric($instance['limit'])) ? $instance['limit'] : 5;
21
+ $orderby = ($instance['orderby']) ? $instance['orderby'] : 'date';
22
+ $order = ($instance['order']) ? $instance['order'] : 'desc';
23
+ $exclude = ($instance['exclude'] != '') ? $instance['exclude'] : 0;
24
+ if($instance['excludeposts'] == 'current')
25
+ $excludeposts = $post->ID;
26
+ if(!isset($excludeposts))
27
+ $excludeposts = ($instance['excludeposts'] != '') ? $instance['excludeposts'] : 0;
28
+ $offset = (is_numeric($instance['offset'])) ? $instance['offset'] : 0;
29
+ $category_id = $instance['categoryid'];
30
+ $dateformat = ($instance['dateformat']) ? $instance['dateformat'] : get_option('date_format');
31
+ $showdate = ($instance['show_date'] == 'on') ? 'yes' : 'no';
32
+ $showmodifieddate = ($instance['show_modified_date'] == 'on') ? 'yes' : 'no';
33
+ $showexcerpt = ($instance['show_excerpt'] == 'on') ? 'yes' : 'no';
34
+ $excerptsize = (empty($instance['excerpt_size']) ? 55 : $instance['excerpt_size']);
35
+ $showauthor = ($instance['show_author'] == 'on') ? 'yes' : 'no';
36
+ $showcatlink = ($instance['show_catlink'] == 'on') ? 'yes' : 'no';
37
+ $thumbnail = ($instance['thumbnail'] == 'on') ? 'yes' : 'no';
38
+ $thumbnail_size = ($instance['thumbnail_size']) ? $instance['thumbnail_size'] : 'thumbnail';
39
+ $morelink = empty($instance['morelink']) ? ' ' : $instance['morelink'];
40
+ if ( empty( $instance['tags_as_class'] ) ) {
41
+ $instance['tags_as_class'] = 'no';
42
+ }
43
+ $tags_as_class = ($instance['tags_as_class'] == 'yes') ? 'yes' : 'no';
44
+ $template = empty($instance['template']) ? 'default' : $instance['template'];
45
+
46
+ $atts = array(
47
+ 'id' => $category_id,
48
+ 'orderby' => $orderby,
49
+ 'order' => $order,
50
+ 'numberposts' => $limit,
51
+ 'date' => $showdate,
52
+ 'date_modified' => $showmodifieddate,
53
+ 'author' => $showauthor,
54
+ 'dateformat' => $dateformat,
55
+ 'template' => 'default',
56
+ 'excerpt' => $showexcerpt,
57
+ 'excerpt_size' => $excerptsize,
58
+ 'exclude' => $exclude,
59
+ 'excludeposts' => $excludeposts,
60
+ 'offset' => $offset,
61
+ 'catlink' => $showcatlink,
62
+ 'thumbnail' => $thumbnail,
63
+ 'thumbnail_size' => $thumbnail_size,
64
+ 'morelink' => $morelink,
65
+ 'tags_as_class' => $tags_as_class,
66
+ 'template' => $template,
67
+ );
68
+
69
+ echo $before_widget;
70
+
71
+ if ($title == 'catlink') {
72
+ // If the user has setup 'catlink' as the title, replace it with
73
+ // the category link:
74
+ $lcp_category = get_category($category_id);
75
+ $title = '<a href="' . get_category_link($lcp_category->cat_ID) . '">' .
76
+ $lcp_category->name . '</a>';
77
+ } elseif ($title == 'catname') {
78
+ // If the user has setup 'catname' as the title, replace it with
79
+ // the category link:
80
+ $lcp_category = get_the_category($post->ID);
81
+ $title = $lcp_category[0]->name;
82
+ }
83
+ echo $before_title . $title . $after_title;
84
+
85
+ $catlist_displayer = new CatListDisplayer($atts);
86
+ echo $catlist_displayer->display();
87
+ echo $after_widget;
88
+ }
89
+
90
+ /** @see WP_Widget::update */
91
+ function update($new_instance, $old_instance) {
92
+ $instance = $old_instance;
93
+ $instance['title'] = strip_tags($new_instance['title']);
94
+ $instance['limit'] = strip_tags($new_instance['limit']);
95
+ $instance['orderby'] = strip_tags($new_instance['orderby']);
96
+ $instance['order'] = strip_tags($new_instance['order']);
97
+ $instance['exclude'] = strip_tags($new_instance['exclude']);
98
+ $instance['excludeposts'] = strip_tags($new_instance['excludeposts']);
99
+ $instance['offset'] = strip_tags($new_instance['offset']);
100
+ $instance['categoryid'] = strip_tags($new_instance['categoryid']);
101
+ $instance['dateformat'] = strip_tags($new_instance['dateformat']);
102
+ $instance['show_date'] = strip_tags($new_instance['show_date']);
103
+ $instance['show_modified_date'] = strip_tags($new_instance['show_modified_date']);
104
+ $instance['show_excerpt'] = strip_tags($new_instance['show_excerpt']);
105
+ $instance['excerpt_size'] = strip_tags($new_instance['excerpt_size']);
106
+ $instance['show_author'] = strip_tags($new_instance['show_author']);
107
+ $instance['show_catlink'] = strip_tags($new_instance['show_catlink']);
108
+ $instance['show_catlink'] = strip_tags($new_instance['show_catlink']);
109
+ $instance['thumbnail'] = strip_tags($new_instance['thumbnail']);
110
+ $instance['thumbnail_size'] = strip_tags($new_instance['thumbnail_size']);
111
+ $instance['morelink'] = strip_tags($new_instance['morelink']);
112
+ $instance['tags_as_class'] = strip_tags($new_instance['tags_as_class']);
113
+ $instance['template'] = strip_tags($new_instance['template']);
114
+
115
+ return $instance;
116
+ }
117
+
118
+ /** @see WP_Widget::form */
119
+ function form($instance) {
120
+ include('lcp-widget-form.php');
121
+ }
122
+ }
123
+
124
+ add_action('widgets_init', create_function('', 'return register_widget("listCategoryPostsWidget");'));
list-category-posts.php CHANGED
@@ -1,206 +1,208 @@
1
- <?php
2
- /*
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 by category in 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, the number of posts to display and many more parameters. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
- Version: 0.72
7
- Author: Fernando Briano
8
- Author URI: http://fernandobriano.com
9
-
10
- Text Domain: list-category-posts
11
- Domain Path: /languages/
12
-
13
- Copyright 2008-2016 Fernando Briano (email : fernando@picandocodigo.net)
14
-
15
- This program is free software; you can redistribute it and/or modify
16
- it under the terms of the GNU General Public License as published by
17
- the Free Software Foundation; either version 3 of the License, or
18
- any later version.
19
-
20
- This program is distributed in the hope that it will be useful,
21
- but WITHOUT ANY WARRANTY; without even the implied warranty of
22
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
- GNU General Public License for more details.
24
-
25
- You should have received a copy of the GNU General Public License
26
- along with this program; if not, write to the Free Software
27
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
- */
29
-
30
-
31
- include 'include/lcp-widget.php';
32
- include 'include/lcp-options.php';
33
- require_once 'include/lcp-catlistdisplayer.php';
34
-
35
- class ListCategoryPosts{
36
- /**
37
- * Gets the shortcode parameters and instantiate plugin objects
38
- * @param $atts
39
- * @param $content
40
- */
41
- static function catlist_func($atts, $content = null) {
42
- $atts = shortcode_atts(array(
43
- 'id' => '0',
44
- 'name' => '',
45
- 'orderby' => '',
46
- 'order' => '',
47
- 'numberposts' => '',
48
- 'date' => 'no',
49
- 'date_tag' => '',
50
- 'date_class' =>'',
51
- 'dateformat' => get_option('date_format'),
52
- 'date_modified' => '',
53
- 'date_modified_tag' => '',
54
- 'date_modified_class' => '',
55
- 'author' => 'no',
56
- 'author_posts_link' => 'no',
57
- 'author_tag' =>'',
58
- 'author_class' => '',
59
- 'author_posts' => '',
60
- 'template' => '',
61
- 'excerpt' => 'no',
62
- 'excerpt_size' => '55',
63
- 'excerpt_strip' => 'yes',
64
- 'excerpt_overwrite' => 'no',
65
- 'excerpt_tag' =>'',
66
- 'excerpt_class' =>'',
67
- 'exclude' => '0',
68
- 'excludeposts' => '0',
69
- 'offset' => '0',
70
- 'tags' => '',
71
- 'exclude_tags' => '',
72
- 'currenttags' => '',
73
- 'content' => 'no',
74
- 'content_tag' => '',
75
- 'content_class' => '',
76
- 'display_id' => 'no',
77
- 'catlink' => 'no',
78
- 'catname' => 'no',
79
- 'catlink_string' => '',
80
- 'catlink_tag' =>'',
81
- 'catlink_class' => '',
82
- 'child_categories' => 'yes',
83
- 'comments' => 'no',
84
- 'comments_tag' => '',
85
- 'comments_class' => '',
86
- 'starting_with' => '',
87
- 'thumbnail' => 'no',
88
- 'thumbnail_size' => 'thumbnail',
89
- 'thumbnail_class' => '',
90
- 'force_thumbnail' => '',
91
- 'title_tag' => '',
92
- 'title_class' => '',
93
- 'title_limit' => '0',
94
- 'post_type' => '',
95
- 'post_status' => '',
96
- 'post_parent' => '0',
97
- 'post_suffix' => '',
98
- 'show_protected' => 'no',
99
- 'class' => 'lcp_catlist',
100
- 'conditional_title' => '',
101
- 'conditional_title_tag' => '',
102
- 'conditional_title_class' => '',
103
- 'customfield_name' => '',
104
- 'customfield_value' =>'',
105
- 'customfield_display' =>'',
106
- 'customfield_display_glue' => '',
107
- 'customfield_display_name' =>'',
108
- 'customfield_display_name_glue' => ' : ',
109
- 'customfield_display_separately' => 'no',
110
- 'customfield_orderby' =>'',
111
- 'customfield_tag' => '',
112
- 'customfield_class' => '',
113
- 'taxonomy' => '',
114
- 'terms' => '',
115
- 'categorypage' => '',
116
- 'category_count' => '',
117
- 'category_description' => 'no',
118
- 'morelink' => '',
119
- 'morelink_class' => '',
120
- 'morelink_tag' => '',
121
- 'posts_morelink' => '',
122
- 'posts_morelink_class' => '',
123
- 'year' => '',
124
- 'monthnum' => '',
125
- 'search' => '',
126
- 'link_target' => '',
127
- 'pagination' => 'no',
128
- 'pagination_next' => '>>',
129
- 'pagination_prev' => '<<',
130
- 'no_posts_text' => "",
131
- 'instance' => '0',
132
- 'no_post_titles' => 'no',
133
- 'link_titles' => true,
134
- 'link_dates' => 'no',
135
- 'after' => '',
136
- 'after_year' => '',
137
- 'after_month' => '',
138
- 'after_day' => '',
139
- 'before' => '',
140
- 'before_year' => '',
141
- 'before_month' => '',
142
- 'before_day' => '',
143
- 'tags_as_class' => 'no',
144
- ), $atts);
145
- if($atts['numberposts'] == ''){
146
- $atts['numberposts'] = get_option('numberposts');
147
- }
148
- if($atts['pagination'] == 'yes' ||
149
- (get_option('lcp_pagination') === 'true' &&
150
- $atts['pagination'] !== 'false') ){
151
- lcp_pagination_css();
152
- }
153
- $catlist_displayer = new CatListDisplayer($atts);
154
- return $catlist_displayer->display();
155
- }
156
- }
157
-
158
- add_shortcode( 'catlist', array('ListCategoryPosts', 'catlist_func') );
159
-
160
- function lpc_meta($links, $file) {
161
- $plugin = plugin_basename(__FILE__);
162
-
163
- if ($file == $plugin):
164
- return array_merge(
165
- $links,
166
- array( sprintf('<a href="http://wordpress.org/extend/plugins/list-category-posts/other_notes/">%s</a>', __('How to use','list-category-posts')) ),
167
- array( sprintf('<a href="http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/#support">%s</a>', __('Donate','list-category-posts')) ),
168
- array( sprintf('<a href="https://github.com/picandocodigo/List-Category-Posts">%s</a>', __('Fork on Github','list-category-posts')) )
169
- );
170
- endif;
171
-
172
- return $links;
173
- }
174
-
175
- add_filter( 'plugin_row_meta', 'lpc_meta', 10, 2 );
176
-
177
- //adds a default value to numberposts on plugin activation
178
- function set_default_numberposts() {
179
- add_option('numberposts', 10);
180
- }
181
- register_activation_hook( __FILE__, 'set_default_numberposts' );
182
-
183
- function load_i18n(){
184
- load_plugin_textdomain( 'list-category-posts', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
185
- }
186
- add_action( 'plugins_loaded', 'load_i18n' );
187
-
188
- function lcp_pagination_css(){
189
- if ( @file_exists( get_stylesheet_directory() . '/lcp_paginator.css' ) ):
190
- $css_file = get_stylesheet_directory_uri() . '/lcp_paginator.css';
191
- elseif ( @file_exists( get_template_directory() . '/lcp_paginator.css' ) ):
192
- $css_file = get_template_directory_uri() . '/lcp_paginator.css';
193
- else:
194
- $css_file = plugin_dir_url(__FILE__) . '/lcp_paginator.css';
195
- endif;
196
-
197
- wp_enqueue_style( 'lcp_paginator', $css_file);
198
- }
199
-
200
- /**
201
- * TO-DO:
202
- - Pagination * DONE - Need to add "page" text
203
- - Add Older Posts at bottom of List Category Post page
204
- - Simpler template system
205
- - Exclude child categories
206
- */
 
 
1
+ <?php
2
+ /*
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 by category in 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, the number of posts to display and many more parameters. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
+ Version: 0.72
7
+ Author: Fernando Briano
8
+ Author URI: http://fernandobriano.com
9
+
10
+ Text Domain: list-category-posts
11
+ Domain Path: /languages/
12
+
13
+ Copyright 2008-2016 Fernando Briano (email : fernando@picandocodigo.net)
14
+
15
+ This program is free software; you can redistribute it and/or modify
16
+ it under the terms of the GNU General Public License as published by
17
+ the Free Software Foundation; either version 3 of the License, or
18
+ any later version.
19
+
20
+ This program is distributed in the hope that it will be useful,
21
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23
+ GNU General Public License for more details.
24
+
25
+ You should have received a copy of the GNU General Public License
26
+ along with this program; if not, write to the Free Software
27
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
28
+ */
29
+
30
+
31
+ include 'include/lcp-widget.php';
32
+ include 'include/lcp-options.php';
33
+ require_once 'include/lcp-catlistdisplayer.php';
34
+
35
+ class ListCategoryPosts{
36
+ /**
37
+ * Gets the shortcode parameters and instantiate plugin objects
38
+ * @param $atts
39
+ * @param $content
40
+ */
41
+ static function catlist_func($atts, $content = null) {
42
+ $atts = shortcode_atts(array(
43
+ 'id' => '0',
44
+ 'name' => '',
45
+ 'orderby' => '',
46
+ 'order' => '',
47
+ 'numberposts' => '',
48
+ 'date' => 'no',
49
+ 'date_tag' => '',
50
+ 'date_class' =>'',
51
+ 'dateformat' => get_option('date_format'),
52
+ 'date_modified' => '',
53
+ 'date_modified_tag' => '',
54
+ 'date_modified_class' => '',
55
+ 'author' => 'no',
56
+ 'author_posts_link' => 'no',
57
+ 'author_tag' =>'',
58
+ 'author_class' => '',
59
+ 'author_posts' => '',
60
+ 'template' => '',
61
+ 'excerpt' => 'no',
62
+ 'excerpt_size' => '55',
63
+ 'excerpt_strip' => 'yes',
64
+ 'excerpt_overwrite' => 'no',
65
+ 'excerpt_tag' =>'',
66
+ 'excerpt_class' =>'',
67
+ 'exclude' => '0',
68
+ 'excludeposts' => '0',
69
+ 'offset' => '0',
70
+ 'tags' => '',
71
+ 'exclude_tags' => '',
72
+ 'currenttags' => '',
73
+ 'content' => 'no',
74
+ 'content_tag' => '',
75
+ 'content_class' => '',
76
+ 'display_id' => 'no',
77
+ 'catlink' => 'no',
78
+ 'catname' => 'no',
79
+ 'catlink_string' => '',
80
+ 'catlink_tag' =>'',
81
+ 'catlink_class' => '',
82
+ 'child_categories' => 'yes',
83
+ 'comments' => 'no',
84
+ 'comments_tag' => '',
85
+ 'comments_class' => '',
86
+ 'starting_with' => '',
87
+ 'thumbnail' => 'no',
88
+ 'thumbnail_size' => 'thumbnail',
89
+ 'thumbnail_class' => '',
90
+ 'force_thumbnail' => '',
91
+ 'title_tag' => '',
92
+ 'title_class' => '',
93
+ 'title_limit' => '0',
94
+ 'post_type' => '',
95
+ 'post_status' => '',
96
+ 'post_parent' => '0',
97
+ 'post_suffix' => '',
98
+ 'show_protected' => 'no',
99
+ 'class' => 'lcp_catlist',
100
+ 'conditional_title' => '',
101
+ 'conditional_title_tag' => '',
102
+ 'conditional_title_class' => '',
103
+ 'customfield_name' => '',
104
+ 'customfield_value' =>'',
105
+ 'customfield_display' =>'',
106
+ 'customfield_display_glue' => '',
107
+ 'customfield_display_name' =>'',
108
+ 'customfield_display_name_glue' => ' : ',
109
+ 'customfield_display_separately' => 'no',
110
+ 'customfield_orderby' =>'',
111
+ 'customfield_tag' => '',
112
+ 'customfield_class' => '',
113
+ 'taxonomy' => '',
114
+ 'taxonomies_and' => '',
115
+ 'taxonomies_or' => '',
116
+ 'terms' => '',
117
+ 'categorypage' => '',
118
+ 'category_count' => '',
119
+ 'category_description' => 'no',
120
+ 'morelink' => '',
121
+ 'morelink_class' => '',
122
+ 'morelink_tag' => '',
123
+ 'posts_morelink' => '',
124
+ 'posts_morelink_class' => '',
125
+ 'year' => '',
126
+ 'monthnum' => '',
127
+ 'search' => '',
128
+ 'link_target' => '',
129
+ 'pagination' => 'no',
130
+ 'pagination_next' => '>>',
131
+ 'pagination_prev' => '<<',
132
+ 'no_posts_text' => "",
133
+ 'instance' => '0',
134
+ 'no_post_titles' => 'no',
135
+ 'link_titles' => true,
136
+ 'link_dates' => 'no',
137
+ 'after' => '',
138
+ 'after_year' => '',
139
+ 'after_month' => '',
140
+ 'after_day' => '',
141
+ 'before' => '',
142
+ 'before_year' => '',
143
+ 'before_month' => '',
144
+ 'before_day' => '',
145
+ 'tags_as_class' => 'no',
146
+ ), $atts);
147
+ if($atts['numberposts'] == ''){
148
+ $atts['numberposts'] = get_option('numberposts');
149
+ }
150
+ if($atts['pagination'] == 'yes' ||
151
+ (get_option('lcp_pagination') === 'true' &&
152
+ $atts['pagination'] !== 'false') ){
153
+ lcp_pagination_css();
154
+ }
155
+ $catlist_displayer = new CatListDisplayer($atts);
156
+ return $catlist_displayer->display();
157
+ }
158
+ }
159
+
160
+ add_shortcode( 'catlist', array('ListCategoryPosts', 'catlist_func') );
161
+
162
+ function lpc_meta($links, $file) {
163
+ $plugin = plugin_basename(__FILE__);
164
+
165
+ if ($file == $plugin):
166
+ return array_merge(
167
+ $links,
168
+ array( sprintf('<a href="http://wordpress.org/extend/plugins/list-category-posts/other_notes/">%s</a>', __('How to use','list-category-posts')) ),
169
+ array( sprintf('<a href="http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/#support">%s</a>', __('Donate','list-category-posts')) ),
170
+ array( sprintf('<a href="https://github.com/picandocodigo/List-Category-Posts">%s</a>', __('Fork on Github','list-category-posts')) )
171
+ );
172
+ endif;
173
+
174
+ return $links;
175
+ }
176
+
177
+ add_filter( 'plugin_row_meta', 'lpc_meta', 10, 2 );
178
+
179
+ //adds a default value to numberposts on plugin activation
180
+ function set_default_numberposts() {
181
+ add_option('numberposts', 10);
182
+ }
183
+ register_activation_hook( __FILE__, 'set_default_numberposts' );
184
+
185
+ function load_i18n(){
186
+ load_plugin_textdomain( 'list-category-posts', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
187
+ }
188
+ add_action( 'plugins_loaded', 'load_i18n' );
189
+
190
+ function lcp_pagination_css(){
191
+ if ( @file_exists( get_stylesheet_directory() . '/lcp_paginator.css' ) ):
192
+ $css_file = get_stylesheet_directory_uri() . '/lcp_paginator.css';
193
+ elseif ( @file_exists( get_template_directory() . '/lcp_paginator.css' ) ):
194
+ $css_file = get_template_directory_uri() . '/lcp_paginator.css';
195
+ else:
196
+ $css_file = plugin_dir_url(__FILE__) . '/lcp_paginator.css';
197
+ endif;
198
+
199
+ wp_enqueue_style( 'lcp_paginator', $css_file);
200
+ }
201
+
202
+ /**
203
+ * TO-DO:
204
+ - Pagination * DONE - Need to add "page" text
205
+ - Add Older Posts at bottom of List Category Post page
206
+ - Simpler template system
207
+ - Exclude child categories
208
+ */
readme.txt CHANGED
@@ -1,1165 +1,1155 @@
1
- === List category posts ===
2
- Contributors: fernandobt
3
- Donate Link: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/#support
4
- Tags: list, categories, posts, cms
5
- Requires at least: 3.3
6
- Tested up to: 4.7.3
7
- Stable tag: 0.72
8
- License: GPLv2 or later
9
- License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
-
11
- == Description ==
12
- **This plugin is looking for maintainers!** Please [take a look at
13
- this issue on
14
- GitHub](https://github.com/picandocodigo/List-Category-Posts/issues/134).
15
-
16
- List Category Posts allows you to list posts by category in a post or 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:
17
-
18
- `[catlist id=1]`
19
-
20
- `[catlist name="news"]`
21
-
22
- The shortcode accepts a category name or id, the order in which you
23
- want the posts to display, and the number of posts to display. You can
24
- also display the post author, date, excerpt, custom field values, even
25
- the content! A lot of parameters have been added to customize what to
26
- display and how to show it. Check [the full
27
- documentation](https://github.com/picandocodigo/List-Category-Posts/wiki)
28
- to learn about the different ways to use it.
29
-
30
- The `[catlist]` shortcode can be used as many times as needed with
31
- different arguments on each post/page.
32
- `[catlist id=1 numberposts=10]`
33
-
34
- There's an options page with only one option -for the moment-, new
35
- options will be implemented on demand (as long as they make
36
- sense). Right now the only global option is the `numberposts`
37
- parameter, to define a default number of posts to show for each
38
- instance (you can override this value by using the `numberposts`
39
- parameter in your shortcode).
40
-
41
- **[Read the instructions](https://github.com/picandocodigo/List-Category-Posts/wiki)** to learn which parameters are available and how to use them.
42
-
43
- If you want to **List Categories** instead of posts you can use my other plugin **[List categories](http://wordpress.org/plugins/list-categories/)**.
44
-
45
- You can find **Frequently Asked Questions** [here](https://github.com/picandocodigo/List-Category-Posts/blob/master/doc/FAQ.md#frequently-asked-questions).
46
-
47
- **Customization**
48
-
49
- The different elements to display can be styled with CSS. you can define an HTML tag to wrap the element with, and a CSS class for this tag. Check [the documentation](https://github.com/picandocodigo/List-Category-Posts/wiki) for usage. You can also check [this nice tutorial](http://sundari-webdesign.com/wordpress-the-quest-to-my-perfect-list-view-for-posts-events-and-articles/) which gives lots of tips and how-to's to customize how to display the posts.
50
-
51
- Great to use WordPress as a CMS, and create pages with several categories posts.
52
-
53
- **Widget**
54
-
55
- The plugin includes a widget which works pretty much the same as the
56
- plugin. Just add as many widgets as you want, and select all the
57
- available options from the Appearence > Widgets page. Not all the
58
- functionality in the shortcode has been implemented in the widget
59
- yet. You can use the shortcode for the most flexibility.
60
-
61
- Please, read the information on [the wiki](https://github.com/picandocodigo/List-Category-Posts/wiki)
62
- and
63
- [Changelog](http://wordpress.org/extend/plugins/list-category-posts/changelog/)
64
- to be aware of new functionality, and improvements to the plugin.
65
-
66
- **Videos**
67
-
68
- Some users have made videos on how to use the plugin (thank you, you are awesome!), check them out here:
69
-
70
- * [Manage WordPress Content with List Category Posts Plugin](http://www.youtube.com/watch?v=kBy_qoGKpdo)
71
- * [WordPress: How to List Category Posts on a Page](http://www.youtube.com/watch?v=Zfnzk4IWPNA)
72
-
73
- **Support the plugin**
74
-
75
- If you've found the plugin useful, consider making a [donation via PayPal](http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/#support "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) :).
76
-
77
- **Development**
78
-
79
- Development is being tracked on [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 Git :)
80
-
81
-
82
- ==Installation==
83
-
84
- * Upload the `list-category-posts` directory to your wp-content/plugins/ directory.
85
- * Login to your WordPress Admin menu, go to Plugins, and activate it.
86
- * Start using the '[catlist]` shortcode in your posts and/or pages.
87
- * You can find the List Category Posts widget in the Appearence > Widgets section on your WordPress Dashboard.
88
- * If you want to customize the way the plugin displays the information, check [HTML & CSS Customization](https://github.com/picandocodigo/List-Category-Posts/wiki/HTML-&-CSS-Customization) or the [section on Templates](https://github.com/picandocodigo/List-Category-Posts/wiki/Template-System) on the wiki.
89
-
90
- ==Other notes==
91
-
92
- Since the documentation on how to use the plugin has passed wordpress.org's character limit, the text was cut. I've since started using [a wiki](https://github.com/picandocodigo/List-Category-Posts/wiki) for more comfortable reading and maintaining. Please check it out, suggestions are welcome on GitHub issues!
93
-
94
- ==Instructions on how to use the plugin==
95
-
96
- ==SELECTING THE CATEGORY==
97
- 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:
98
-
99
- * Using the *category id*.
100
- * **id** - To display posts from a category using the category's id. Ex: `[catlist id=24]`.
101
- * The *category name or slug*.
102
- * **name** - To display posts from a category using the category's name or slug. Ex: `[catlist name=mycategory]`
103
- * *Detecting the current post's category*. You can use the *categorypage* parameter to make it detect the category id of the current post, and list posts from that category.
104
- * **categorypage** - Set it to "yes" if you want to list the posts from the current post's category. `[catlist categorypage="yes"]`
105
-
106
- When using List Category Posts whithout a category id, name or slug, it will post the latest posts from **every category**.
107
-
108
- ==USING MORE THAN ONE CATEGORY==
109
-
110
- * Posts from several categories with an **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]`.
111
- * Posts from several categories with an **OR** relationship, posts that belong to any of the listed categories: `[catlist id=17,24,32]` - `[catlist name=sega,nintendo]`.
112
- * **Exclude** a category with the minus sign (-): `[catlist id=11,-32,16]`, `[catlist id=1+2-3]`. **Important**: When using the *and* relationship, you should write the categories you want to include first, and then the ones you want to exclude. So `[catlist id=1+2-3]` will work, but `[catlist id=1+2-3+4]` won't.
113
-
114
- ==Other ways of selecting what posts to show==
115
-
116
- * **child_categories** - Exclude/include posts from the child categories. By default they are included. If you have a "Parent Category" and you use: `[catlist name="Parent Category"]`, you'll see posts from it's child categories as if they were posts from the same category. You can use this parameter to exclude these posts: `[catlist name="Parent Category" child_categories=false]`.
117
-
118
- * **author_posts** - Get posts by author. Use 'user_nicename' (NOT
119
- name). Example: `[catlist author_posts="fernando"]`
120
-
121
- * **tags** - Tag support, display posts from a certain tag. You can use an "OR" relationship `[catlist tags="nintendo,sega"]` or "AND" relationship (posts that belong to all of the listed tags): `[catilst tags="nintendo+sega"]`.
122
-
123
- * **taxonomy** - You can select posts using custom taxonomies. You need to set the taxonomy and the terms: `[catlist taxonomy='person' terms='bob']`.
124
-
125
- * **currenttags** - Display posts from the current post's tags (won't
126
- work on pages since they have no tags). Pass it the 'yes' string for it to work: `[catlist currenttags="yes"]`
127
-
128
- * **exclude_tags** - Exclude posts from one or more tags: `[catlist tags="videogames" exclude_tags="sega,sony"]`
129
-
130
- * **starting_with** - Get posts whose title starts with a certain
131
- letter. Example: `[catlist starting_with="l"]` will list all posts
132
- whose title starts with L. You can use several letters: `[catlist starting_with="m,o,t"]`.
133
-
134
- * **monthnum** and **year** - List posts from a certain year or month. You can use these together or independently. Example: `[catlist year=2015]` will list posts from the year 2015. `[catlist monthnum=8]` will list posts published in August of every year. `[catlist year=2012 monthnum=12]` will list posts from December 2012.
135
-
136
- * **date ranges** - You can also use date ranges for listing posts. For example "list every post after March 14th, 2005". The parameters are: ```after, after_year, after_month, after_day, before, before_year, before_month, before_day```. These parameters are used to specify data_query arguments (see: [the codex](https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters)).
137
-
138
- If you want to list all the posts before a given date, say `Jun 17th, 2007` you can use these two options:
139
- `[catlist before_year=2007 before_month=06 before_day=17]`
140
- Or you can use the `before` parameter with a [strtotime()-compatible string](http://php.net/manual/en/datetime.formats.date.php):
141
- `[catlist before='2007/06/17']`
142
-
143
- The same works for posts after a given date, you can use:
144
- `[catlist after_year=2007 after_month=06 after_day=17]`
145
- Or just `after` with a [strtotime()-compatible string](http://php.net/manual/en/datetime.formats.date.php):
146
- `[catlist after='2007/06/17']`
147
-
148
- `after` takes priority over `after_year`, `after_month`, and `after_day`.
149
- `before` takes priority over `before_year`, `before_month`, and `before_day`.
150
-
151
- * **search** - List posts that match a search term. `[catlist search="The Cake is a lie"]`
152
-
153
- * **excludeposts** - IDs of posts to exclude from the list. Use 'this' to exclude the current post. Ex: `[catlist excludeposts=this,12,52,37]`
154
-
155
- * **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.
156
-
157
- * **post_type** - The type of post to show. Available options are: post - Default, page, attachment, any - all post types. You can use several types, example: `[catlist post_type="page,post" numberposts=-1]`
158
-
159
- * **post_status** - use post status, default value is 'publish'. Valid values:
160
- * **publish** - a published post or page.
161
- * **pending** - post is pending review.
162
- * **draft** - a post in draft status.
163
- * **auto-draft** - a newly created post, with no content.
164
- * **future** - a post to publish in the future.
165
- * **private** - not visible to users who are not logged in.
166
- * **inherit** - a revision. see get_children.
167
- * **trash** - post is in trashbin (available with Version 2.9).
168
- * **any** - retrieves any status except those from post types with 'exclude_from_search' set to true.
169
- You can use several post statuses. Example: `[catlist post_status="future, publish" excludeposts=this]`
170
-
171
- * **show_protected** - Show posts protected by password. By default
172
- they are not displayed. Use: `[catlist show_protected=yes]`
173
-
174
- * **post_parent** - Show only the children of the post with this ID.
175
- Default: None.
176
-
177
- * **custom fields** - To use custom fields, you must specify two values: customfield_name and customfield_value. `customfield_name` defines the name of the field, and you should choose the values for which you want posts to display. Using this only show posts that contain a custom field with this name and value. Both parameters must be defined, or neither will work. Eg: `[catlist customfield_name="color" customfield_value="green"]` will display posts with the value `green` set on the custom field `color`.
178
-
179
- ==PAGINATION
180
-
181
- https://github.com/picandocodigo/List-Category-Posts/wiki/Pagination
182
-
183
- ==OTHER PARAMETERS==
184
-
185
- * **conditional_title** - Display a custom title before the posts list.
186
- The title is not displayed if the list is empty. Set to the empty string
187
- (default value) to disable.
188
- Example: `[catlist conditional_title="Other posts"]`.
189
-
190
- * **conditional_title_tag** - Specify the tag used for the conditional title.
191
- Defaults to 'h3'.
192
-
193
- * **conditional_title_class** - Specify the class used for the conditional
194
- title. Defaults to the empty string (no special class).
195
-
196
- * **orderby** - To customize the order. Valid values are:
197
- * **author** - Sort by the numeric author IDs.
198
- * **category** - Sort by the numeric category IDs.
199
- * **content** - Sort by content.
200
- * **date** - Sort by creation date.
201
- * **ID** - Sort by numeric post ID.
202
- * **menu_order** - Sort by the menu order. Only useful with pages.
203
- * **mime_type** - Sort by MIME type. Only useful with attachments.
204
- * **modified** - Sort by last modified date.
205
- * **name** - Sort by stub.
206
- * **parent** - Sort by parent ID.
207
- * **password** - Sort by password.
208
- * **rand** - Randomly sort results.
209
- * **status** - Sort by status.
210
- * **title** - Sort by title.
211
- * **type** - Sort by type. Ex: `[catlist name=mycategory orderby=date]`
212
-
213
- * **customfield_orderby** - You can order the posts by a custom field. For example: `[catlist numberposts=-1 customfield_orderby=Mood order=desc]` will list all the posts with a "Mood" custom field. Remember the default order is descending, more on order:
214
-
215
- * **order** - How to sort **orderby**. Valid values are:
216
- * **ASC** - Ascending (lowest to highest).
217
- * **DESC** - Descending (highest to lowest). Ex: `[catlist name=mycategory orderby=title order=asc]`
218
-
219
- * **numberposts** - Number of posts to return. Set to 0 to use the max
220
- number of posts per page. Set to -1 to remove the limit.
221
- Ex: `[catlist name=mycategory numberposts=10]`
222
- You can set the default number of posts globally on the options
223
- page on your Dashboard in Settings / List Category Posts.
224
-
225
- * **no_posts_text** - Text to display when no posts are found. If you
226
- don't specify it, nothing will get displayed where the posts
227
- should be.
228
-
229
- * **date** - Display post's date next to the title. Default is 'no',
230
- use date=yes to activate it. You can set a css class and an html
231
- tag to wrap the date in with `date_class` and `date_tag` (see HTML
232
- & CSS Customization further below).
233
-
234
- * **date_modified** - Display the date a post was last modified next
235
- to the title. You can set a css class and an html tag to wrap the
236
- date in with `date_modified_class` and `date_modified_tag` (see
237
- HTML & CSS Customization further below).
238
-
239
- * **author** - Display the post's author next to the title. Default is
240
- 'no', use author=yes to activate it. You can set a css class and an html
241
- tag to wrap the author name in with `author_class` and `author_tag` (see HTML
242
- & CSS Customization further below).
243
-
244
- When displaying the post author, you can also display a link to the
245
- author's page. The following parameter **only works if author=yes
246
- is present in the shortcode**:
247
-
248
- * **author_posts_link** - Gets the URL of the author page for the
249
- author. The HTML and CSS customization are the ones applied to `author`.
250
-
251
- * **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.
252
-
253
- * **excerpt** - Display a plain text excerpt of the post. Default is 'no', use `excerpt=yes` or `excerpt=full` to activate it. If you have a separate excerpt in your post, this text will be used. If you don't have an explicit excerpt in your post, the plugin will generate one from the content, striping its images, shortcodes and HTML tags. If you want to overwrite the post's separate excerpt with an automatically generated one (may be useful to allow HTML tags), use `excerpt_overwrite=yes`.
254
-
255
- If you use `excerpt=yes`, the separate excerpt or content will be limited to the number of words set by the *excerpt_size* parameter (55 words by default).
256
-
257
- If you use `excerpt=full` the plugin will act more like Wordpress. If the post has a separate excerpt, it will be used in full. Otherwise if the content has a &lt;!--more--&gt; tag then the excerpt will be the text before this tag, and if there is no &lt;!--more--&gt; tag then the result will be the same as `excerpt=yes`.
258
-
259
- If you want the automatically generated excerpt to respect your theme's allowed HTML tags, you should use `excerpt_strip=no`, otherwise the HTML tags are automatically stripped.
260
-
261
- * **excerpt_size** - Set the number of *words* to display from the excerpt. Default is 55. Eg: `excerpt_size=30`
262
-
263
- * **excerpt_strip** - Set it to `yes` to strip the excerpt's HTML tags. If the excerpt is auto generated by the plugin, the HTML tags will be stripped, and you should use `excerpt_strip=no` to see the excerpt with HTML formatting.
264
-
265
- * **title_limit** - Set the limit of characters for the title. Ex:
266
- `[catlist id=2 title_limit=50]` will show only the first 50
267
- characters of the title and add "…" at the end.
268
-
269
- * **content** - **WARNING**: If you want to show the content on your listed posts, you might want to do this from a new [Page Template](http://codex.wordpress.org/Page_Templates) or a [Custom Post Type](http://codex.wordpress.org/Post_Types#Custom_Post_Type_Templates) template. Using this parameter is discouraged, you can have memory issues as well as infinite loop situations when you're displaying a post that's using List Category Posts. You have been warned. Usage:
270
-
271
- * `yes` - Show the excerpt or full content of the post. If there's a &lt;!--more--&gt; tag in the post, then it will behave just as WordPress does: only show the content previous to the more tag. Default is 'no'. Ex: `[catlist content=yes]`
272
-
273
- * `full` - Show the full content of the post regardless of whether there is a &lt;!--more--&gt; tag in the post. Ex: `[catlist content=full]`
274
-
275
- * **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.
276
-
277
- * **category_description** Show the category description wrapped in a p tag: `[catlist id=1 category_description='yes']`
278
-
279
- * **catname** - Show the title of the category (or categories), works exactly as `catlink`, but it doesn't add a link to the category.
280
-
281
- * **category_count** - Shows the posts count in that category, only works when using the **catlink** option: `[catlist name=nintendo catlink=yes category_count=yes]`
282
-
283
- * **comments** - Show comments count for each post. Default is 'no'. Ex: `[catlist comments=yes]`.
284
-
285
- * **thumbnail** - Show post thumbnail (http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/). Default is 'no'. Ex: `[catlist thumbnail=yes]`.
286
-
287
- * **force_thumbnail** - If the previous parameter is set to 'yes', and there's no featured image, setting this to 'yes' or 'true' will make the plugin look for the first image in the post and use it as a thumbnail. Ex: `[catlist thumbnail=yes force_thumbnail=yes]`.
288
-
289
- * **thumbnail_size** - Either a string keyword (thumbnail, medium, large or full) or 2 values representing width and height in pixels. Ex: `[catlist thumbnail_size=32,32]` or `[catlist thumbnail_size=thumbnail]`
290
-
291
- * **thumbnail_class** - Set a CSS class for the thumbnail.
292
-
293
- * **post_suffix** - Pass a String to this parameter to display this
294
- String after every post title.
295
- Ex: `[catlist numberposts=-1
296
- post_suffix="Hello World"]` will create something like:
297
-
298
- ```<ul class="lcp_catlist" id=lcp_instance_0>
299
- <li>
300
- <a href="http://127.0.0.1:8080/wordpress/?p=42" title="WordPress">
301
- WordPress
302
- </a> Hello World </li>```
303
-
304
- * **display_id** - Set it to yes to show the Post's ID next to the post title: `[catlist id=3 display_id=yes]`
305
-
306
- * **class** - CSS class for the default UL generated by the plugin.
307
-
308
- * **tags_as_class** - Use a post's tags as a class for the `li` that lists the posts. Default is `no`. For example, `[catlist tags_as_class=yes]` will show a post that has the `fun` tag like this:
309
- ```
310
- <li class=" fun ">
311
- <a href="http://localhost:8080/?p=1267" title="Post Title">Post Title</a>
312
- </li>
313
- ```
314
-
315
- * **customfield_display** - Display custom field(s). You can specify
316
- many fields to show, separating them with a coma. If you want to
317
- display just the value and not the name of the custom field, use
318
- `customfield_display_name` and set it to no.
319
- By default, the custom fields will show inside a div with a
320
- specific class: `<div class="lcp-customfield">`. You can customize
321
- this using the customfield_tag and customfield_class parameters to
322
- set a different tag (instead of the div) and a specific class
323
- (instead of lcp-customfield).
324
-
325
- * **customfield_display_glue** - Specify the text to appear between two custom
326
- fields if displayed together, defaults to the empty string. Not used if
327
- the `customfield_display_separately` parameter is defined.
328
-
329
- * **customfield_display_separately** - Display the custom fields separately.
330
- Each custom field is displayd within its own tag (see `customfield_tag`).
331
- Defaults to 'no', set to 'yes' to enable. Superseeds the
332
- `customfield_display_glue` parameter when enabled.
333
-
334
- * **customfield_display_name** - To use with `customfield_display`.
335
- Use it to just print the value of the Custom field and not the
336
- name. Example:
337
- `[catlist numberposts=-1 customfield_display="Mood"
338
- customfield_display_name="no"]`
339
- Will print the value of the Custom Field "Mood" but not the text
340
- "Mood: [value]".
341
-
342
- * **customfield_display_name_glue** - To use with `customfield_display_name`.
343
- Use it to specify the text between the name and the value, defaults to
344
- ' : '.
345
-
346
- * **template** - By default, posts will be listed in an unordered list
347
- (ul tag) with the class 'lcp_catlist':
348
-
349
- `<ul class="lcp_catlist"><li><a href="post1">Post 1</a></li>...`
350
-
351
- You can use a different class by using the *class* parameter.
352
-
353
- You can create your own template file (Check **Template System**
354
- further down this document) and pass it as a parameter here. The
355
- parameter is the template name without the extension. For example
356
- for `mytemplate.php`, the value would be `mytemplate`.
357
-
358
- You can also pass these two parameters which yield different
359
- results:
360
- * `div` - This will output a div with the `lcp_catlist` class
361
- (or one you pass as a parameter with the `class` argument). The
362
- posts will be displayed between p tags. `[catlist template=div]`
363
-
364
- * `ol` - This will output an ordered list with the `lcp_catlist`
365
- css class (or the one you pass as a parameter with the `class`
366
- argument) and each post will be a list item inside the ordered list. `[catlist template=ol]`.
367
-
368
- * **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"]`
369
-
370
- * **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"]`
371
-
372
- * **link_target** - Select the `target` attribute for links to posts (target=_blank, _self, _parent, _top, *framename*). Example: `[catlink id=3 link_target=_blank]` will create: `<a href="http://localhost/wordpress/?p=45" title="Test post" target="_blank">Test post</a>`
373
-
374
- * **no_post_titles** - If set to `yes`, no post titles will be shown. This may make sense together with `content=yes`.
375
-
376
- * **link_titles** - Option to display titles without links. If set to `false`, the post titles won't be linking to the article.
377
-
378
- * **link_dates** - Option to wrap dates with a link to the post. Set to `true` or `yes` to enable, set to `false` or `no` to disable. Defaults to `false`.
379
-
380
- == Widget ==
381
-
382
- The widget is quite simple, and it doesn't implement all of the plugin's functionality. To use a shortcode in a widget add this code to your theme's functions.php file:
383
-
384
- `add_filter('widget_text', 'do_shortcode');`
385
-
386
- Then just add a new text widget to your blog and use the shortcode there as the widget's content.
387
-
388
- == HTML & CSS Customization ==
389
-
390
- https://github.com/picandocodigo/List-Category-Posts/wiki/HTML-&-CSS-Customization
391
-
392
- == Template System ==
393
-
394
- https://github.com/picandocodigo/List-Category-Posts/wiki/Template-System
395
-
396
- == Frequently Asked Questions ==
397
-
398
- **FAQ**
399
-
400
- You can find the Frequently Asked Questions [here](https://github.com/picandocodigo/List-Category-Posts/blob/master/doc/FAQ.md#frequently-asked-questions).
401
-
402
- **INSTRUCTIONS ON HOW TO USE THE PLUGIN**
403
-
404
- https://github.com/picandocodigo/List-Category-Posts/wiki/
405
-
406
- Please read the instructions and the FAQ before opening a new topic in the support forums.
407
-
408
- **TEMPLATE SYSTEM**
409
-
410
- How to customize the way the posts are shown: https://github.com/picandocodigo/List-Category-Posts/wiki/Template-System. I am aware the Template System is not the friendliest right now, I'll work on improving this if I ever get the time to work on it.
411
-
412
- **NEW FEATURE REQUESTS, BUG FIXES, ENHANCEMENTS**
413
-
414
- You can post them on [GitHub Issues](https://github.com/picandocodigo/List-Category-Posts/issues).
415
-
416
- **FURTHER QUESTIONS**
417
-
418
- Please check the [FAQ](https://github.com/picandocodigo/List-Category-Posts/blob/master/doc/FAQ.md#frequently-asked-questions) before posting a question. You can post questions in the [Support forum](http://wordpress.org/support/plugin/list-category-posts) or [add a new issue on GitHub](https://github.com/picandocodigo/List-Category-Posts/issues).
419
-
420
- == Upgrade Notice ==
421
-
422
- = 0.66 =
423
- Full release notes:
424
- https://github.com/picandocodigo/List-Category-Posts/releases/tag/0.66
425
-
426
- = 0.65 =
427
- Full release notes here: https://github.com/picandocodigo/List-Category-Posts/releases/tag/0.65
428
-
429
- = 0.37 =
430
-
431
- 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).
432
-
433
- = 0.34 =
434
- * 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](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) under **HTML & CSS Customization** for more info.
435
- * 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](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for more info).
436
-
437
- = 0.25 =
438
- * Translation support.
439
-
440
- = 0.18 =
441
- 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.
442
-
443
- = 0.17 =
444
- 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.
445
-
446
- = 0.13.2 =
447
- Thumbnail parameter 'thumbnails' changed to 'thumbnail.
448
-
449
- = 0.7.2 =
450
- Template system has changed. Now the posts loop must be defined inside the template. Check templates/default.php for an example.
451
-
452
- = 0.8 =
453
- Widget built for WordPress 2.8's Widget API, so you need at least WP 2.8 to use the widget.
454
-
455
- = 0.9 =
456
- Template system has changed. Custom templates should be stored in WordPress theme folder.
457
-
458
- == Changelog ==
459
-
460
- = 0.72 =
461
-
462
- Several bug fixes:
463
-
464
- * Makes sure the `tags_as_class` instance variable is defined. This squelched an 'undefined index' PHP Notice that appeared for widgets that were last saved before upgrading to 0.71.1. Fix by Matthew Eppelsheimer (@MatthewEppelsheimer on GitHub).
465
- * Adds a new tutorial in the docs, check it out!
466
- * Fixes a bug where customfield_value wouldn't work if a custom field's value = 0
467
- * Adds tag/class html customization refactor to excerpt to behave as expected:
468
- * If you provide `excerpt_tag` but not `excerpt_class`, excerpt will be wrapped with given tag.
469
- * If you provide `excerpt_tag` and `excerpt_class`, excerpt will be wrapped with provided tag and given class.
470
- * If you provide `excerpt_class` but not `excerpt_tag`, excerpt will be wrapped with a span and the given class.
471
- * Fixes an error notice when widget is displayed for "current category" on post without category - `Notice: Undefined offset: 0 in /include/lcp-category.php on line 69`
472
-
473
-
474
- = 0.71.1 =
475
-
476
- * Fixes ["Undefined index: tags_as_class"](https://github.com/picandocodigo/List-Category-Posts/issues/227). Thanks @vacuus for the Pull Request! :)
477
-
478
- = 0.71 =
479
-
480
- * Added tags_as_class: Use a post's tags as a class for the li that lists the posts. Default is no. Thanks @vacuus on GitHub for this PR!
481
-
482
- = 0.70 =
483
-
484
- * Fixed [customfield_class and customfield_tag issues](https://github.com/picandocodigo/List-Category-Posts/issues/201). Thanks [vacuus](https://github.com/vacuus)!!
485
- * Tested up to WordPress 4.6.1
486
- * Added date range, thanks again [vacuus](https://github.com/vacuus)!! Check [the docs](https://github.com/picandocodigo/List-Category-Posts/wiki/How-to-select-which-posts-to-show) to read how to use this.
487
-
488
- = 0.69 =
489
-
490
- * Update lcp-widget.php for PHP 7 compatibility. Thanks @kenshin23!
491
-
492
- = 0.68 =
493
-
494
- Thanks @mmatthews1981, @ottadvantage and @mhoeher for their contributions on this version:
495
-
496
- * Adds Alt Tag to thumbnail
497
- * Handle child_categories flag correctly - https://github.com/picandocodigo/List-Category-Posts/pull/185
498
- * Adds a default value to numberposts on plugin activation - https://github.com/picandocodigo/List-Category-Posts/pull/193
499
-
500
-
501
- = 0.67.1 =
502
- * Bugfix release, this should fix the issues with Parent Categories listings.
503
-
504
- = 0.67 =
505
- * Adds custom css class to current page in pagination `lcp_currentpage`.
506
- * Adds child_categories parameter to being able to exclude child categories' posts from a list.
507
- * New feature to look for the first image in a post when requesting a thumbnail and the post has no featured image. Thanks Michael J. Gibbs for writing this code :)
508
-
509
- = 0.66 =
510
- * Full release notes: https://github.com/picandocodigo/List-Category-Posts/releases/tag/0.66
511
- * Orders the README a bit.
512
- * Issues with tags when using more than one tag for OR and AND relationships should be fixed.
513
- * Documented the use of custom taxonomies. For some reason I never came around to do that. I changed the parameters for taxonomies, it used the 'tags' parameter for 'terms' before, so I added a 'terms' parameter to make this independent from the tags parameter. So now it looks like this: `[catlist taxonomy='person' terms='bob']`. This might break some current uses of taxonomy, but since it was written so long ago and I don't know why it used "tags", I decided to just create the 'terms' parameter. People using the custom taxonomies were people who are looking at the code anyway since I can't find it documented anywhere. Sorry for the inconveniences!
514
- * Adds category description parameter.
515
- * Adds orderby and order to options page. Removes default values since they're the default anyway.
516
-
517
- = 0.65 =
518
-
519
- * Adds pagination parameter to the options page.
520
- * Changes the loop in the default template.
521
- * Fixes 'morelink_class not working with templates' in the default template.
522
- * Adds link to post wrapper for the post date. If you have a chance, please thank [bibz](https://github.com/bibz) who is doing awesome Pull Requests to this plugin and occasionally helping out on the support forums here too :)
523
-
524
- = 0.64 =
525
-
526
- * Fixes get_current_tags
527
- * Some updates on the documentation
528
- * Introduces a conditional title, only displayed when posts are found, thanks [bibz](https://github.com/bibz) for this Pull Request!
529
- * Introduces `customfield_display_separately`, `customfield_display_glue` and `customfield_display_name_glue` parameters for multiple custom fields handling by bibz. Thanks! :D
530
-
531
- = 0.63.1 =
532
- * Remove renamed file (Damn using subversion), should fix issues updating.
533
-
534
- = 0.63 =
535
-
536
- * Vagrant box and development environment improved by bibz
537
- * Tested with WordPress 4.3, updated Widget constructor because of [PHP 4 deprecation](https://make.wordpress.org/core/2015/07/02/deprecating-php4-style-constructors-in-wordpress-4-3/).
538
-
539
- = 0.62 =
540
-
541
- * Dutch translation by Gerhard Hoogterp, thank you!
542
- * Re-add the loop fixes and fixes function missing from last time by Sophist-UK, thanks!
543
- * Allow to order by the modified date in the widget by bibz, thanks!
544
-
545
- = 0.61 =
546
-
547
- * Adds Portuguese from Portugal (pt_PT) translation, muito obrigado Joaquim Félix!
548
- * Fixes translation paths, [thanks monpelaud](https://wordpress.org/support/topic/error-of-name-on-some-translation-files-1)!.
549
-
550
-
551
- = 0.60.1 =
552
-
553
- * Reverts switching to the loop til we find a way around for using templates.
554
-
555
- = 0.60 =
556
-
557
- * Fixes the loop so that other plugins work as if this was a blog or archive post.
558
- See [issue #156](https://github.com/picandocodigo/List-Category-Posts/issues/156)
559
- on Github. Thanks Sophist-UK for this new version :)
560
-
561
- = 0.59.2 =
562
-
563
- * Tested with WordPress 4.2
564
- * Sophist's fix: Check for multi-byte functions installed and use ascii functions if not.
565
-
566
- = 0.59.1 =
567
-
568
- * Fix some errors
569
-
570
- = 0.59 =
571
-
572
- **Thanks Sophist from UK for this release** :)
573
-
574
- By Sophist:
575
-
576
- * Fix error causing call to undefined method
577
- * Add excerpt=full to allow either full explicit excerpt or use <?--more--> to define where the excerpt ends.
578
- * Fixes link_titles=false creates plain text rather than unlinked formatted text as you might expect.
579
- * Fixes title_limit not working correctly
580
-
581
- Other minor fixes by me.
582
-
583
- = 0.58.1 =
584
- * Fixes an error with pagination links. Accessing $_SERVER filtered not working on some servers, have to investigate further for a future version.
585
- * Addresses warning messages when debug enabled.
586
-
587
- = 0.58 =
588
- * Removes filter interfering with filters set by other plugins. Thanks [zulkamal](https://github.com/zulkamal) for the Pull Request!
589
- * Adds option to display titles without links. Thanks zulkamal for this Pull Request too! :D
590
- * Workaround to prevent '?&' to appear in URLs. Thanks [mhoeher](https://github.com/mhoeher) for the Pull Request!
591
- * General refactors for improving code quality/security.
592
- * Fixed typo in Readme (Thanks Irma!).
593
- * Fixes excluding tags when using category name (should fix other issues with category name too since there was a bug there).
594
-
595
- = 0.57 =
596
- * Add custom image sizes to the list of selectable image sizes in the widget. Thanks [nuss](https://github.com/nuss) for the Pull Request!
597
- * New Attribute 'no_post_titles'. Thanks [thomasWeise](https://github.com/thomasWeise) for the Pull Request!
598
- * Finnish localization. Thanks [Newman101](https://github.com/Newman101) for the Pull Request!
599
-
600
- = 0.56 =
601
- * Adds Indonesian (Bahasa Indonesia) translation. Thanks Dhyayi Warapsari!
602
- * Adds french from France language. Thanks Dorian Herlory!
603
- * Adds content=full parameter to ignore <!--more--> tags when displaying content. Thanks Sophist-UK!
604
- * Fixes excluded_tags parameter
605
-
606
- = 0.55 =
607
- * Ordered lists now follow the posts count when using pagination - https://wordpress.org/support/topic/templateol-resets-count-when-using-pagination
608
- * Fixes issue introduced in 0.54 with undefined indexes - https://wordpress.org/support/topic/problem-continues-with-0542
609
-
610
- = 0.54.2 =
611
- * Fixes call to undefined method lcp_get_current_post_id()
612
-
613
- = 0.54.1 =
614
- * Fixes bug in LcpParameters.
615
-
616
- = 0.54 =
617
- * Adds http/https check for pagination links.
618
- * Fixes `post_status` and `post_type` parameters for using multiple post statuses and types.
619
- * Big refactor: Thumbnail code, parameters moved to new class,
620
- created util class, removed bad and repeated code, moved category
621
- code to new class. Small fixes all around the place. Went from a
622
- very bad 1.77 GPA to 3.23 on CodeClimate.
623
-
624
-
625
- = 0.53 =
626
- * Makes "starting_with" parameter accept several letters, by Diego Sorribas. Thank you!
627
-
628
- = 0.52 =
629
- * Small fix for pagination and query string.
630
- * Fix on multiple categories with AND relationship.
631
- * Fixes options page 404 and saving options.
632
- * Tested with WordPress 4.1.
633
-
634
- = 0.51 =
635
- * Fixes translations, updates Spanish translation. Translators, please update your po and mo files and submit them via pull request on GitHub :)
636
- * Test compatibility with WordPress 4.0
637
- * Adds icon for WordPress 4.0 new plugin interface.
638
- * Fixes posts_morelink and customfields for templates.
639
- * Adds fixes by [htrex](https://github.com/htrex):
640
- * Fix custom template regression
641
- * Fix excluded categories not working in widget
642
-
643
- = 0.50.3 =
644
-
645
- * Addresses some warnings / scandir on Displayer and catname on widget
646
- * Fixes lcp_paginator.css path
647
- * Some small sanitations
648
-
649
- = 0.50.2 =
650
-
651
- * Small fix on templates
652
-
653
- = 0.50.1 =
654
-
655
- * Fixes issue with catlink.
656
- * Fixes issue with templates named "default"
657
-
658
- = 0.50 =
659
-
660
- * Adds Thai translation by [itpcc](https://github.com/itpcc).
661
- * The widget can now select an existing template. Thanks [Borjan Tchakaloff](https://github.com/bibz)!
662
- * Templates code was refactored.
663
-
664
- = 0.49.1 =
665
-
666
- * Makes sure "starting_with" queries are case insesitive.
667
- * Fixes category link on 'catlink' and 'catname' parameters (were showing twice)
668
-
669
- = 0.49 =
670
-
671
- * Adds `author_posts_link`, to show an author's page.
672
- * Adds catname parameter to show just the category name (and not the link). Thanks user sirenAri from the [forum](http://wordpress.org/support/topic/a-couple-of-suggestions-and-one-teensy-error).
673
- * Small bug fix for getting current category. Used to check against simple string, now checking against i18n'ed one.
674
-
675
- = 0.48 =
676
-
677
- * Bug fixes
678
- * Adds parameter to show modified date of posts. Thanks Eric Sandine for the Pull Request :)
679
-
680
- = 0.47 =
681
-
682
- * Adds Ukranian translation by Michael Yunat [http://getvoip.com](http://getvoip.com/blog)
683
- * Adds `display_id` parameter. Set it to yes to show the Post's ID next to the post title.
684
- * Adds `starting_with` parameter. Gets posts whose title start with a given letter.
685
-
686
-
687
- = 0.46.4 =
688
- * Finally (hopefully) fix the excerpt issues.
689
-
690
- = 0.46.3 =
691
- * Fix something that I broke on previous update for excerpt :S
692
-
693
- = 0.46.2 =
694
- * Some fixes on displaying excerpt.
695
-
696
- = 0.46.1 =
697
- * Fixes quotes bug on title tag.
698
- * Only show ellipsis when title.size > title_limit when using the
699
- title_limit param.
700
-
701
- = 0.46 =
702
- * Adds "the_excerpt" filter to excerpt to improve compatibility with
703
- the [Jetpack](http://wordpress.org/plugins/jetpack/) plugin.
704
- * Add character limit to title
705
- * Removes debug warnings
706
- * Output valid HTML, attribute quotations - thanks Nikolaus Demmel!
707
-
708
- = 0.45 =
709
- * Adds ol default template to `template` parameter.
710
- * Improves documentation.
711
-
712
- = 0.44.1 =
713
- * Removes warning when using current tag in pages
714
- * Small fix on Readme
715
-
716
- = 0.44 =
717
- * Adds the feature to get an author's posts
718
- * Adds show posts from current post's tags.
719
-
720
- = 0.43.1 =
721
- * Show "no posts text" only if it's been set and there are no posts,
722
- otherwise behave like before.
723
-
724
- = 0.43 =
725
- * Removes filters to order by (should fix issues with order)
726
- * Adds `pagination_prev` and `pagination_next` params to customize
727
- the "Previous" and "Next" buttons on pagination navigation.
728
- * Only show pages in pagination when they are > 1
729
- * Adds `no_posts_text` param to display a custom message when no
730
- posts are found
731
- * Fixes "morelink" class parameter (now can be used without
732
- specifying an HTML tag and the class is applied to the a tag).
733
-
734
- = 0.42.3 =
735
- * Adds missing title attribute from thumbnail links.
736
-
737
- = 0.42.2 =
738
- * Fixes pagination numbers
739
- * Removes warning on wp-debug set to true
740
-
741
- = 0.42.1 =
742
- * Fixes some debug warnings (Ruby's nil doesn't apply in the PHP World)
743
-
744
- = 0.42 =
745
- * Fixes excludeposts=this.
746
- * Adds customfield_tag and customfield_class to customize an HTML tag
747
- and CSS class for custom fields.
748
-
749
- = 0.41.2 =
750
- * Small bugfix with customfield_display_name (wasn't working now it
751
- is)
752
-
753
- = 0.41.1 =
754
- * Fixes customfield display name.
755
- * Fixes size in getting thumbnails, now checks for all available
756
- sizes and defaults ("thumbnail", "full", etc.)
757
-
758
- = 0.41.0 =
759
- * Adds options page, to set the default numberposts value globally.
760
- * Adds `customfield_display_name` param.
761
- * Adds pagination to custom template.
762
- * Fixes date display.
763
- * Adds conditions to Vagrantfile to boot faster and not repeat work.
764
- * Fixes exclude posts, broken when migrating from get_posts to
765
- WP_Query.
766
-
767
- = 0.40.1 =
768
-
769
- * Small fix closing quotes on content when using <!--more-->
770
-
771
- = 0.40 =
772
-
773
- * Tested with WordPress 3.8
774
- * Removes unnecessary stuff on wp_enqueue_styles
775
- * Fixes validation when using quotes in title
776
- * Fixes on <!--more--> tag
777
- * Fixes on title HTML tag and CSS class. (*See HTML & CSS
778
- Customization* on [Other Notes](http://wordpress.org/plugins/list-category-posts/other_notes/) to check the expected behaviour)
779
-
780
- = 0.39 =
781
-
782
- * Adds "post suffix" parameter, to add a String after each post
783
- listed. [Source](http://wordpress.org/support/topic/hack-post-title-adding-elements)
784
-
785
- = 0.38 =
786
-
787
- * Adds pagination. Check **Pagination** on [Other
788
- notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/)
789
- to learn how to use it.
790
- * Adds "How to display thumbnails next to title" to the FAQ.
791
- * Adds a Vagrant box for developers to be able to start coding with
792
- no effort :)
793
-
794
- = 0.37 =
795
- * Supports `more` tag. If there's a &lt;!--more--&gt; tag in the post, then it will behave just as WordPress does: only show the content previous to the more tag.
796
- * Fixes YouTube thumbnails: Includes "embed" urls for youtube video
797
- thumbnails, makes correct img tag when using CSS class.
798
-
799
- = 0.36.2 =
800
-
801
- * Fixed category_count for several categories.
802
-
803
- = 0.36.1 =
804
-
805
- * Fixed catlink to display titles for all the categories when using more than one category.
806
-
807
- = 0.36 =
808
-
809
- * Adds option for "target=_blank" for post links.
810
- * Adds option to exclude category when using the *and* relationship: `[catlist id=1+2-3]` will include posts from categories 1 and 2 but not 3.
811
-
812
- = 0.35 =
813
- * Updated Turkish translation, thanks again [Hakan Er](http://hakanertr.wordpress.com/)!
814
- * Adds feature to order by custom field using the `customfield_orderby` parameter.
815
-
816
- = 0.34.1 =
817
- * Bugfix (removed var_dump)
818
-
819
- = 0.34 =
820
- * Now 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 wrap the element between span tags and the given CSS class. Check [Other notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) under **HTML & CSS Customization** for more info.
821
- * 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](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for more info).
822
-
823
- = 0.33 =
824
- * Fixes bug with thumbnail size on Widget.
825
- * Adds feature to make widget title a link to the category. Use 'catlink' as the value for the widget's title to make it a link to the category (based on https://github.com/picandocodigo/List-Category-Posts/pull/51/).
826
- * Fixes morelink styiling with CSS class and tag.
827
- * Adds morelink to templates (based on https://github.com/picandocodigo/List-Category-Posts/pull/48/)
828
- * Fixes tag and CSS class for "catlink" too: http://wordpress.org/support/topic/cat_link-tag-does-not-seem-to-be-working
829
-
830
- = 0.32 =
831
- * Add category count parameter to show the number of posts in a category next to its title. Only works when using the **catlink** option: `[catlist name=nintendo catlink=yes category_count=yes]` - http://wordpress.org/support/topic/count-feature
832
-
833
- = 0.31 =
834
- * Pull request from @cfoellmann, adds testing environment and Travis CI integration. Awesomeness.
835
- * When searching for a thumbnail, if there's no thumbnail on the post but there's a YouTube video, display the YouTube video thumbnail. (wordpress.org/support/topic/youtube-thumbnail)
836
-
837
- = 0.30.3 =
838
- * Bugfix release, fixes current category for post/page
839
-
840
- = 0.30.2 =
841
- * Improves 'current category' detection.
842
- * Adds categorypage parameter to widget
843
-
844
- = 0.30.1 =
845
- * **excerpt** - Fixed default excerpt behaviour from previous release. By default it **will** strip html tags as it always did. If you want it not to strip tags, you'll have to use `excerpt_strip=no`. Added a new parameter to have a consistent excerpt. If you want to overwrite WordPress' excerpt when using the plugin and generate one the way the plugin does when there's no excerpt, use `excerpt_overwrite=yes`.
846
-
847
- = 0.30 =
848
- * Adds ability to exclude tags.
849
- * 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`.
850
-
851
- = 0.29 =
852
- * Adds turkish translation, thanks [Hakan Er](http://hakanertr.wordpress.com/) for writing this translation! :)
853
- * 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
854
- * More improvements on readme.
855
-
856
- = 0.28 =
857
- * Improvements on readme, faqs.
858
- * New posts_morelink param: adds a 'read more' link to each post.
859
-
860
- = 0.27.1 =
861
-
862
- * Sets minimum version to WordPress 3.3, since wp_trim_words was introduced in that version. Adds workaround for people using WordPress < 3.3.
863
- * Adds Slovak translation by Branco from [WebHostingGeeks.com](http://webhostinggeeks.com/blog/).
864
- * Removes Debug PHP warnings.
865
- * Checkboxes on Widget save state, i18n for widget.
866
- * Adds excerpt size to widget.
867
-
868
- = 0.27 =
869
-
870
- * Fixes to widget.
871
- * Adds year and month parameters to list posts from a certain year and/or month.
872
- * Adds search parameter to display posts that match a search term.
873
-
874
- = 0.26 =
875
-
876
- * Adds i18n, German and Spanish translations. All credit to [cfoellmann](https://github.com/cfoellmann) for implementing this and writing the German translation. Thanks! :)
877
-
878
- = 0.25.1 =
879
-
880
- * Changed excerpt limit, it uses word count, and is working for WordPress' excerpt and auto generated ones.
881
-
882
- = 0.25 =
883
-
884
- * Better excerpt
885
- * Applies title filter, should work with qTranslate
886
- * Adds post status parameter
887
- * Adds meta links to plugin page - most importantly: INSTRUCTIONS (please read them).
888
-
889
- = 0.24 =
890
-
891
- * Fixes "excerpt doesn't strip shortcodes" - https://github.com/picandocodigo/List-Category-Posts/issues/5
892
- * 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)
893
- * Add title to category title [1](http://wordpress.stackexchange.com/questions/44467/list-category-plugin-changing-the-links), will be improved.
894
- * Attempting to condition whitespaces to WordPress Coding Standard (emacs php-mode sucks for this...)
895
- * 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.
896
-
897
- = 0.23.2 =
898
-
899
- * Bugfix release
900
-
901
- = 0.23.1 =
902
-
903
- * Bugfix release
904
-
905
- = 0.23 =
906
-
907
- This update is dedicated to [Michelle K McGinnis](http://friendlywebconsulting.com/) who bought me "Diamond Age" by Neal Stephenson from my [Amazon Wishlist](http://www.amazon.com/gp/registry/wishlist/2HU1JYOF7DX5Q/ref=wl_web). Thanks! :D
908
-
909
- * Added excerpt size. You can set how many characters you want the excerpt to display with 'excerpt_size'.
910
- * Fixed HTML tag and CSS class for each element (Check [Other notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for usage).
911
- * Removed shortcodes from excerpt.
912
-
913
- = 0.22.3 =
914
-
915
- * Fixed thumbnail size parameter, added usage example on README.
916
- * Added space after author and date http://wordpress.org/support/topic/plugin-list-category-posts-space-required-after
917
-
918
- = 0.22.2 =
919
-
920
- * Fixed bug with the categorypage=yes param.
921
- * Tested with WordPress 3.3.
922
-
923
- = 0.22.1 =
924
-
925
- * Fixed accidentally deleted line which made the catlink=yes param not work.
926
-
927
- = 0.22 =
928
-
929
- * Added CSS "current" class hook for current post in the list: .current class attached to either the li or a tag of the currently viewed page in the said list. http://wordpress.stackexchange.com/q/35552/298
930
- * Added *morelink* parameter, check Other notes for usage.
931
-
932
- = 0.21.2 =
933
-
934
- * Removed var_dump... (Sorry about that)
935
-
936
- = 0.21.1 =
937
-
938
- * Small fixes:
939
- * Used "empty()" function for some Strings instead of evaluating isset() and != ''.
940
- * Include parameters on the get_posts args only when they are set (post_parent among others).
941
-
942
- = 0.21 =
943
-
944
- * Added 'thumbnail_class' parameter, so you can set a CSS class to the thumbnail and style it.
945
-
946
- = 0.20.5 =
947
-
948
- * Brought back the multiple categories functionality for the id parameter. Hopefully the last 0.20 bugfix release so I can start working on new stuff to implement.
949
- * Now the name parameter accepts multiple categories too. Just use: `[catlist name=category1,category2]`
950
-
951
- = 0.20.4 =
952
-
953
- * Yet another bugfix, regarding nothing being displayed when using tags.
954
-
955
- = 0.20.3 =
956
-
957
- * Fixed category detection code, which created some messy bugs in some cases
958
-
959
- = 0.20.2 =
960
-
961
- * Minor bugfix release
962
-
963
- = 0.20.1 =
964
-
965
- * Fixed extra " added to ul tag, thanks ideric (http://wordpress.org/support/topic/plugin-list-category-posts-extra-added-to-ul-tag)
966
-
967
- = 0.20 =
968
-
969
- * Added the possibility to list posts from the current post's category
970
- * Some fixes to documentation
971
-
972
- = 0.19.3 =
973
-
974
- * Another taxonomy fix, thanks frisco! http://wordpress.org/support/topic/plugin-list-category-posts-problem-with-custom-taxonomies
975
-
976
- = 0.19.2 =
977
-
978
- * Small fix, missing parameter for taxonomy.
979
-
980
- = 0.19.1 =
981
-
982
- * Added thumbnail to Widget.
983
- * Added thumbnail link to post (http://picod.net/33).
984
-
985
- = 0.19 =
986
-
987
- This update is dedicated to S. Keller from Switzerland who gave me "The Ultimate Hitchhiker's Guide to the Galaxy" from my Amazon Wishlit in appreciation for the plugin. I am really enjoying the read :D. If you, like S would like to show your appreciation, here's my [wishlist](http://www.amazon.com/gp/registry/wishlist/2HU1JYOF7DX5Q/ref=wl_web):
988
-
989
- * Fixed private post logic, not displaying post if private. Thanks Bainternet from WordPress Answers: http://wordpress.stackexchange.com/questions/12514/list-category-posts-not-showing-posts-marked-private-to-logged-in-users/12520#12520
990
- * Added thumbnail_size parameter.
991
- * Added support for custom taxonomies and also moved to the array call of get_posts. Coded by wsherliker, thanks! http://picod.net/32
992
- * Fixed widget, now it remembers saved options.
993
-
994
- = 0.18.3 =
995
-
996
- * Small excerpt fix, some readme file fixing too.
997
- * Not showing the_content for password protected posts.
998
-
999
- = 0.18.2 =
1000
-
1001
- * Small fixes. Should work for name parameter in all cases now.
1002
-
1003
- = 0.18.1 =
1004
-
1005
- * Added slug and name to the fetching of category id from previous update.
1006
-
1007
- = 0.18 =
1008
-
1009
- * Fixed category id bug. Reported and fixed by Eric Celeste - http://eric.clst.org, thanks!
1010
- * Improved template system a liitle bit, now you can pass an HTML tag and a CSS class to sorround each field on your template.
1011
- * Added category link which wasn't working after previous big update.
1012
-
1013
- = 0.17.1 =
1014
-
1015
- * Fixed displaying of "Author:" even when not being called.
1016
-
1017
- = 0.17 =
1018
-
1019
- * Major rewrite. The whole code was rewritten using objects. It's easier now to develop for List Category Posts.
1020
- * Both STYLESHEETPATH and TEMPLATEPATH are checked for templates.
1021
-
1022
- = 0.16.1 =
1023
-
1024
- * Fixed shortcode nesting.
1025
-
1026
- = 0.16 =
1027
-
1028
- * Changed STYLESHEETPATH to TEMPLATEPATH to point to the parent theme.
1029
- * Added support to display custom fields. (http://picod.net/wp03)
1030
- * Tested with WordPress 3.1 - http://wordpress.org/support/topic/399754
1031
-
1032
-
1033
- = 0.15.1 =
1034
-
1035
- * Fixed a bug with undeclared variable. (Check http://picod.net/walcp, thanks Das!)
1036
-
1037
- = 0.15 =
1038
-
1039
- * Added custom fields support. Define both custom field (customfield_name) and value (customfield_value) to use it.
1040
-
1041
- = 0.14.1 =
1042
-
1043
- * Fixed "Show the title of the category with a link to the category" code (catlink param), it broke on some previous update, but now it's working again. Thanks Soccerwidow on the WP Forums for pointing this out.
1044
-
1045
- = 0.14 =
1046
-
1047
- * Added "post_type" and "post_parent" from the underlining "get_posts()" API to be usable within the short-code. By Martin Crawford, thanks!
1048
- * Added the "class" parameter to style the default ul. You can pass a class name, or the plugin will use "lcp_catlist" bby default. Thanks Chocolaterebel (http://wordpress.org/support/topic/plugin-list-category-posts-sharing-my-own-template-in-lcp).
1049
- * Fixed "tags" parameter on the documentation, it used to say "tag", and the plugin looks for "tags".
1050
-
1051
- = 0.13.2 =
1052
-
1053
- * Fixed thumbnail code, added it to default.php template as example.
1054
-
1055
- = 0.13.1 =
1056
-
1057
- * Fixed broken dateformat.
1058
-
1059
- = 0.13 =
1060
-
1061
- * Show post thumbnails, should be tested, feedback on styling is welcome. Thanks to Sebastian from http://www.avantix.com.ar/
1062
-
1063
- = 0.12 =
1064
-
1065
- * Added comments count.
1066
- * Updated readme file
1067
-
1068
- = 0.11.2 =
1069
-
1070
- * Another minimal bug fixed with the excerpt...
1071
-
1072
- = 0.11.1 =
1073
-
1074
- * Fixed small bug which made the excerpt show up everytime... (Sorry :S)
1075
-
1076
- = 0.11 =
1077
-
1078
- * Automatic excerpt added in case the user didn't specifically write an excerpt.
1079
- * Widget has been finally fixed. The attributes finally save themselves, and the widget works as expected :D
1080
-
1081
-
1082
- = 0.10.1 =
1083
- * Small fix -
1084
- added ul tags to default template.
1085
- * Compatible WordPress 3.0 with Twenty Ten theme (thanks again Doug Joseph :) )
1086
-
1087
- = 0.10 =
1088
-
1089
- * Code for the_content was fixed so that the content to output filtered content (thanks DougJoseph http://wordpress.org/support/topic/399754)
1090
-
1091
- = 0.9 =
1092
-
1093
- * admin parameter now shows "display name" instead of "user nice name".
1094
- * Template system has changed: In older version, custom templates got deleted if an automatic upgrade was done. Now templates are stored in the theme folder. (Thanks Paul Clark)
1095
- * Added tag support
1096
-
1097
- = 0.8.1 =
1098
-
1099
- * Fixed bug for 'content'.
1100
- * There's new stuff on the widget options. I'm still working on it, so some bugs may appear.
1101
-
1102
- = 0.8 =
1103
-
1104
- * Widget implements WP 2.8 Widget API, so at least 2.8 is required. Now you can use as many widgets as necessary, with new params.
1105
- * Updated readme file.
1106
-
1107
- = 0.7.2 =
1108
-
1109
- * Fixed link to category.
1110
- * Improved template system.
1111
-
1112
- = 0.7.1 =
1113
-
1114
- * Fixed uber stupid bug with offset... Sorry about that!
1115
-
1116
- = 0.7 =
1117
-
1118
- * Exclude posts. Contribution by acub.
1119
- * Offset parameter on shortcode to start listing posts with an offset. Contribution by Levi Vasquez
1120
- * Content of the post can now be displayed. Contribution by Lang Zerner.
1121
- * Link to the category available. By request on the plugin's forum.
1122
- * Fixed small bug when using category name.
1123
-
1124
- = 0.6 =
1125
-
1126
- * Minor fix for unclosed ul if not using templates.
1127
- * Added option to list posts from many categories at once.
1128
- * Added option to exclude categories.
1129
-
1130
- = 0.5 =
1131
-
1132
- * Readme.txt validation.
1133
- * Added 'excerpt' parameter. You can now show the excerpt for each post.
1134
- * Added 'dateformat' parameter. Format of the date output. Default is get_option('date_format') - by Verex
1135
- * Added 'template' parameter. Now you can choose template for output of the plugin. File name of template from templates directory without extension. Example: For 'template.php' value is only 'template'. Default is 'default' that means template in code of plugin not in template file -by Verex
1136
-
1137
- = 0.4.1 =
1138
-
1139
- * Fixed some code to enable PHP 4 compatibility. Shouldn't hosting services update to PHP 5?
1140
-
1141
- = 0.4 =
1142
-
1143
- * Added 'date' parameter. Now you can show the post's date when listed.
1144
- * Added 'author' parameter. You can also show the post's author.
1145
- * Sidebar Widget now allows you to add a title in h2 tags.
1146
- * Changed some variable names, to keep better compatibility with other plugins/wordpress variables.
1147
- * Tested with Wordpress 2.7.
1148
-
1149
- = 0.3 =
1150
-
1151
- * Broke backwards compatibility. Users of version 0.1 should update their pages and posts for the new shortcode formatting.
1152
- * Option to pass arguments to the plugin, in order to use name of category instead of ID, orderby, order and number of posts are passed through parameters.
1153
-
1154
- = 0.2 =
1155
-
1156
- * Added experimental sidebar widget (use at your own risk, not ready for prime-time yet since it hasn't been tested :P )
1157
-
1158
- = 0.1.1 =
1159
-
1160
- * Fixed major bug, which gave 404 error when trying to use "Options" page.
1161
-
1162
- = 0.1 =
1163
-
1164
- * Option page to limit number of posts.
1165
- * Working using [category=ID] for posts and pages, with several categories support.
1
+ === List category posts ===
2
+ Contributors: fernandobt
3
+ Donate Link: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/#support
4
+ Tags: list, categories, posts, cms
5
+ Requires at least: 3.3
6
+ Tested up to: 4.9
7
+ Requires PHP: 5.2.4
8
+ Stable tag: 0.73
9
+ License: GPLv2 or later
10
+ License URI: http://www.gnu.org/licenses/gpl-2.0.html
11
+
12
+ List Category Posts allows you to list posts by category and many other parameters in a post, page or widget. You use the [catlist] shortcode to select which posts to show and how. There's tons of customizations available.
13
+
14
+ == Description ==
15
+
16
+ List Category Posts allows you to list posts by category in a post or 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:
17
+
18
+ `[catlist id=1]`
19
+
20
+ `[catlist name="news"]`
21
+
22
+ 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! A lot of parameters have been added to customize what to display and how to show it. Check [the full documentation](https://github.com/picandocodigo/List-Category-Posts/wiki) to learn about the different ways to use it.
23
+
24
+ The `[catlist]` shortcode can be used as many times as needed with different arguments on each post/page.
25
+ `[catlist id=1 numberposts=10]`
26
+
27
+ There's an options page with only one option -for the moment-, new options will be implemented on demand (as long as they make sense). Right now the only global option is the `numberposts` parameter, to define a default number of posts to show for each instance (you can override this value by using the `numberposts` parameter in your shortcode).
28
+
29
+ **[Read the instructions](https://github.com/picandocodigo/List-Category-Posts/wiki)** to learn which parameters are available and how to use them.
30
+
31
+ If you want to **List Categories** instead of posts you can use my other plugin **[List categories](http://wordpress.org/plugins/list-categories/)**.
32
+
33
+ You can find **Frequently Asked Questions** [here](https://github.com/picandocodigo/List-Category-Posts/blob/master/doc/FAQ.md#frequently-asked-questions).
34
+
35
+ **Customization**
36
+
37
+ The different elements to display can be styled with CSS. you can define an HTML tag to wrap the element with, and a CSS class for this tag. Check [the documentation](https://github.com/picandocodigo/List-Category-Posts/wiki) for usage. You can also check [this nice tutorial](http://sundari-webdesign.com/wordpress-the-quest-to-my-perfect-list-view-for-posts-events-and-articles/) which gives lots of tips and how-to's to customize how to display the posts.
38
+
39
+ Great to use WordPress as a CMS, and create pages with several categories posts.
40
+
41
+ **Widget**
42
+
43
+ Since WordPress 4.9, [you can use shortcode in text widgets](https://make.wordpress.org/core/2017/10/24/widget-improvements-in-wordpress-4-9/). So you can just add a text widget in Appearence > Widgets and write the List Category Posts shortcode.
44
+
45
+ The plugin also includes a widget as a simple interface for its functionality. Just add as many widgets as you want, and select all the available options from the Appearence > Widgets page. Not all the functionality in the shortcode has been implemented in the widget yet. You can use the shortcode for the most flexibility.
46
+
47
+ Please, read the information on [the wiki](https://github.com/picandocodigo/List-Category-Posts/wiki) and [Changelog](http://wordpress.org/extend/plugins/list-category-posts/changelog/) to be aware of new functionality, and improvements to the plugin.
48
+
49
+ **Videos**
50
+
51
+ Some users have made videos on how to use the plugin (thank you, you are awesome!), check them out here:
52
+
53
+ * [Manage WordPress Content with List Category Posts Plugin](http://www.youtube.com/watch?v=kBy_qoGKpdo)
54
+ * [WordPress: How to List Category Posts on a Page](http://www.youtube.com/watch?v=Zfnzk4IWPNA)
55
+
56
+ **Support the plugin**
57
+
58
+ If you've found the plugin useful, consider making a [donation via PayPal](http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/#support "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) :).
59
+
60
+ **Development**
61
+
62
+ Development is being tracked on [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 Git :)
63
+
64
+ Since the documentation on how to use the plugin has passed wordpress.org's character limit, the text was cut. I've since started using [a wiki](https://github.com/picandocodigo/List-Category-Posts/wiki) for more comfortable reading and maintaining. Please check it out, suggestions are welcome on GitHub issues!
65
+
66
+ ==Instructions on how to use the plugin==
67
+
68
+ ==SELECTING THE CATEGORY==
69
+ 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:
70
+
71
+ * Using the *category id*.
72
+ * **id** - To display posts from a category using the category's id. Ex: `[catlist id=24]`.
73
+ * The *category name or slug*.
74
+ * **name** - To display posts from a category using the category's name or slug. Ex: `[catlist name=mycategory]`
75
+ * *Detecting the current post's category*. You can use the *categorypage* parameter to make it detect the category id of the current post, and list posts from that category.
76
+ * **categorypage** - Set it to "yes" if you want to list the posts from the current post's category. `[catlist categorypage="yes"]`
77
+
78
+ When using List Category Posts whithout a category id, name or slug, it will post the latest posts from **every category**.
79
+
80
+ ==USING MORE THAN ONE CATEGORY==
81
+
82
+ * Posts from several categories with an **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]`.
83
+ * Posts from several categories with an **OR** relationship, posts that belong to any of the listed categories: `[catlist id=17,24,32]` - `[catlist name=sega,nintendo]`.
84
+ * **Exclude** a category with the minus sign (-): `[catlist id=11,-32,16]`, `[catlist id=1+2-3]`. **Important**: When using the *and* relationship, you should write the categories you want to include first, and then the ones you want to exclude. So `[catlist id=1+2-3]` will work, but `[catlist id=1+2-3+4]` won't.
85
+
86
+ ==Other ways of selecting what posts to show==
87
+
88
+ * **child_categories** - Exclude/include posts from the child categories. By default they are included. If you have a "Parent Category" and you use: `[catlist name="Parent Category"]`, you'll see posts from it's child categories as if they were posts from the same category. You can use this parameter to exclude these posts: `[catlist name="Parent Category" child_categories=false]`.
89
+
90
+ * **author_posts** - Get posts by author. Use 'user_nicename' (NOT
91
+ name). Example: `[catlist author_posts="fernando"]`
92
+
93
+ * **tags** - Tag support, display posts from a certain tag. You can use an "OR" relationship `[catlist tags="nintendo,sega"]` or "AND" relationship (posts that belong to all of the listed tags): `[catilst tags="nintendo+sega"]`.
94
+
95
+ * **taxonomy** - You can select posts using custom taxonomies. There's two ways of selecting taxonomies:
96
+ * You need to set the taxonomy and the terms: `[catlist taxonomy='person' terms='bob']`. It supports both the "IN" and "AND" logical relationships between each inner taxonomy. For the `AND` relationship, separate terms with a plus sign: ` [catlist taxonomy='topic' terms='topic1+topic2']`. For the `OR` relationship, separate terms with a comma: `[catlist taxonomy='topic' terms='topic1,topic2']`.
97
+ * Multiple taxonomies: You can use multiple taxonomy terms in one shortcode like this:
98
+ * OR - `taxonomies_or="tax1:{term1_1,term1_2};tax2:{term2_1,term2_2,term2_3}"`
99
+ * AND - `taxonomies_and="tax1:{term1_1,term1_2};tax2:{term2_1,term2_2,term2_3}"`
100
+
101
+
102
+ * **currenttags** - Display posts from the current post's tags (won't
103
+ work on pages since they have no tags). Pass it the 'yes' string for it to work: `[catlist currenttags="yes"]`
104
+
105
+ * **exclude_tags** - Exclude posts from one or more tags: `[catlist tags="videogames" exclude_tags="sega,sony"]`
106
+
107
+ * **starting_with** - Get posts whose title starts with a certain
108
+ letter. Example: `[catlist starting_with="l"]` will list all posts
109
+ whose title starts with L. You can use several letters: `[catlist starting_with="m,o,t"]`.
110
+
111
+ * **monthnum** and **year** - List posts from a certain year or month. You can use these together or independently. Example: `[catlist year=2015]` will list posts from the year 2015. `[catlist monthnum=8]` will list posts published in August of every year. `[catlist year=2012 monthnum=12]` will list posts from December 2012.
112
+
113
+ * **date ranges** - You can also use date ranges for listing posts. For example "list every post after March 14th, 2005". The parameters are: ```after, after_year, after_month, after_day, before, before_year, before_month, before_day```. These parameters are used to specify data_query arguments (see: [the codex](https://codex.wordpress.org/Class_Reference/WP_Query#Date_Parameters)).
114
+
115
+ If you want to list all the posts before a given date, say `Jun 17th, 2007` you can use these two options:
116
+ `[catlist before_year=2007 before_month=06 before_day=17]`
117
+ Or you can use the `before` parameter with a [strtotime()-compatible string](http://php.net/manual/en/datetime.formats.date.php):
118
+ `[catlist before='2007/06/17']`
119
+
120
+ The same works for posts after a given date, you can use:
121
+ `[catlist after_year=2007 after_month=06 after_day=17]`
122
+ Or just `after` with a [strtotime()-compatible string](http://php.net/manual/en/datetime.formats.date.php):
123
+ `[catlist after='2007/06/17']`
124
+
125
+ `after` takes priority over `after_year`, `after_month`, and `after_day`.
126
+ `before` takes priority over `before_year`, `before_month`, and `before_day`.
127
+
128
+ * **search** - List posts that match a search term. `[catlist search="The Cake is a lie"]`
129
+
130
+ * **excludeposts** - IDs of posts to exclude from the list. Use 'this' to exclude the current post. Ex: `[catlist excludeposts=this,12,52,37]`
131
+
132
+ * **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.
133
+
134
+ * **post_type** - The type of post to show. Available options are: post - Default, page, attachment, any - all post types. You can use several types, example: `[catlist post_type="page,post" numberposts=-1]`
135
+
136
+ * **post_status** - use post status, default value is 'publish'. Valid values:
137
+ * **publish** - a published post or page.
138
+ * **pending** - post is pending review.
139
+ * **draft** - a post in draft status.
140
+ * **auto-draft** - a newly created post, with no content.
141
+ * **future** - a post to publish in the future.
142
+ * **private** - not visible to users who are not logged in.
143
+ * **inherit** - a revision. see get_children.
144
+ * **trash** - post is in trashbin (available with Version 2.9).
145
+ * **any** - retrieves any status except those from post types with 'exclude_from_search' set to true.
146
+ You can use several post statuses. Example: `[catlist post_status="future, publish" excludeposts=this]`
147
+
148
+ * **show_protected** - Show posts protected by password. By default
149
+ they are not displayed. Use: `[catlist show_protected=yes]`
150
+
151
+ * **post_parent** - Show only the children of the post with this ID.
152
+ Default: None.
153
+
154
+ * **custom fields** - To use custom fields, you must specify two values: customfield_name and customfield_value. `customfield_name` defines the name of the field, and you should choose the values for which you want posts to display. Using this only show posts that contain a custom field with this name and value. Both parameters must be defined, or neither will work. Eg: `[catlist customfield_name="color" customfield_value="green"]` will display posts with the value `green` set on the custom field `color`.
155
+
156
+ ==PAGINATION
157
+
158
+ https://github.com/picandocodigo/List-Category-Posts/wiki/Pagination
159
+
160
+ ==OTHER PARAMETERS==
161
+
162
+ * **conditional_title** - Display a custom title before the posts list.
163
+ The title is not displayed if the list is empty. Set to the empty string
164
+ (default value) to disable.
165
+ Example: `[catlist conditional_title="Other posts"]`.
166
+
167
+ * **conditional_title_tag** - Specify the tag used for the conditional title.
168
+ Defaults to 'h3'.
169
+
170
+ * **conditional_title_class** - Specify the class used for the conditional
171
+ title. Defaults to the empty string (no special class).
172
+
173
+ * **orderby** - To customize the order. Valid values are:
174
+ * **author** - Sort by the numeric author IDs.
175
+ * **category** - Sort by the numeric category IDs.
176
+ * **content** - Sort by content.
177
+ * **date** - Sort by creation date.
178
+ * **ID** - Sort by numeric post ID.
179
+ * **menu_order** - Sort by the menu order. Only useful with pages.
180
+ * **mime_type** - Sort by MIME type. Only useful with attachments.
181
+ * **modified** - Sort by last modified date.
182
+ * **name** - Sort by stub.
183
+ * **parent** - Sort by parent ID.
184
+ * **password** - Sort by password.
185
+ * **rand** - Randomly sort results.
186
+ * **status** - Sort by status.
187
+ * **title** - Sort by title.
188
+ * **type** - Sort by type. Ex: `[catlist name=mycategory orderby=date]`
189
+
190
+ * **customfield_orderby** - You can order the posts by a custom field. For example: `[catlist numberposts=-1 customfield_orderby=Mood order=desc]` will list all the posts with a "Mood" custom field. Remember the default order is descending, more on order:
191
+
192
+ * **order** - How to sort **orderby**. Valid values are:
193
+ * **ASC** - Ascending (lowest to highest).
194
+ * **DESC** - Descending (highest to lowest). Ex: `[catlist name=mycategory orderby=title order=asc]`
195
+
196
+ * **numberposts** - Number of posts to return. Set to 0 to use the max
197
+ number of posts per page. Set to -1 to remove the limit.
198
+ Ex: `[catlist name=mycategory numberposts=10]`
199
+ You can set the default number of posts globally on the options
200
+ page on your Dashboard in Settings / List Category Posts.
201
+
202
+ * **no_posts_text** - Text to display when no posts are found. If you
203
+ don't specify it, nothing will get displayed where the posts
204
+ should be.
205
+
206
+ * **date** - Display post's date next to the title. Default is 'no',
207
+ use date=yes to activate it. You can set a css class and an html
208
+ tag to wrap the date in with `date_class` and `date_tag` (see HTML
209
+ & CSS Customization further below).
210
+
211
+ * **date_modified** - Display the date a post was last modified next
212
+ to the title. You can set a css class and an html tag to wrap the
213
+ date in with `date_modified_class` and `date_modified_tag` (see
214
+ HTML & CSS Customization further below).
215
+
216
+ * **author** - Display the post's author next to the title. Default is
217
+ 'no', use author=yes to activate it. You can set a css class and an html
218
+ tag to wrap the author name in with `author_class` and `author_tag` (see HTML
219
+ & CSS Customization further below).
220
+
221
+ When displaying the post author, you can also display a link to the
222
+ author's page. The following parameter **only works if author=yes
223
+ is present in the shortcode**:
224
+
225
+ * **author_posts_link** - Gets the URL of the author page for the
226
+ author. The HTML and CSS customization are the ones applied to `author`.
227
+
228
+ * **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.
229
+
230
+ * **excerpt** - Display a plain text excerpt of the post. Default is 'no', use `excerpt=yes` or `excerpt=full` to activate it. If you have a separate excerpt in your post, this text will be used. If you don't have an explicit excerpt in your post, the plugin will generate one from the content, striping its images, shortcodes and HTML tags. If you want to overwrite the post's separate excerpt with an automatically generated one (may be useful to allow HTML tags), use `excerpt_overwrite=yes`.
231
+
232
+ If you use `excerpt=yes`, the separate excerpt or content will be limited to the number of words set by the *excerpt_size* parameter (55 words by default).
233
+
234
+ If you use `excerpt=full` the plugin will act more like Wordpress. If the post has a separate excerpt, it will be used in full. Otherwise if the content has a &lt;!--more--&gt; tag then the excerpt will be the text before this tag, and if there is no &lt;!--more--&gt; tag then the result will be the same as `excerpt=yes`.
235
+
236
+ If you want the automatically generated excerpt to respect your theme's allowed HTML tags, you should use `excerpt_strip=no`, otherwise the HTML tags are automatically stripped.
237
+
238
+ * **excerpt_size** - Set the number of *words* to display from the excerpt. Default is 55. Eg: `excerpt_size=30`
239
+
240
+ * **excerpt_strip** - Set it to `yes` to strip the excerpt's HTML tags. If the excerpt is auto generated by the plugin, the HTML tags will be stripped, and you should use `excerpt_strip=no` to see the excerpt with HTML formatting.
241
+
242
+ * **title_limit** - Set the limit of characters for the title. Ex:
243
+ `[catlist id=2 title_limit=50]` will show only the first 50
244
+ characters of the title and add "…" at the end.
245
+
246
+ * **content** - **WARNING**: If you want to show the content on your listed posts, you might want to do this from a new [Page Template](http://codex.wordpress.org/Page_Templates) or a [Custom Post Type](http://codex.wordpress.org/Post_Types#Custom_Post_Type_Templates) template. Using this parameter is discouraged, you can have memory issues as well as infinite loop situations when you're displaying a post that's using List Category Posts. You have been warned. Usage:
247
+
248
+ * `yes` - Show the excerpt or full content of the post. If there's a &lt;!--more--&gt; tag in the post, then it will behave just as WordPress does: only show the content previous to the more tag. Default is 'no'. Ex: `[catlist content=yes]`
249
+
250
+ * `full` - Show the full content of the post regardless of whether there is a &lt;!--more--&gt; tag in the post. Ex: `[catlist content=full]`
251
+
252
+ * **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.
253
+
254
+ * **category_description** Show the category description wrapped in a p tag: `[catlist id=1 category_description='yes']`
255
+
256
+ * **catname** - Show the title of the category (or categories), works exactly as `catlink`, but it doesn't add a link to the category.
257
+
258
+ * **category_count** - Shows the posts count in that category, only works when using the **catlink** option: `[catlist name=nintendo catlink=yes category_count=yes]`
259
+
260
+ * **comments** - Show comments count for each post. Default is 'no'. Ex: `[catlist comments=yes]`.
261
+
262
+ * **thumbnail** - Show post thumbnail (http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/). Default is 'no'. Ex: `[catlist thumbnail=yes]`.
263
+
264
+ * **force_thumbnail** - If the previous parameter is set to 'yes', and there's no featured image, setting this to 'yes' or 'true' will make the plugin look for the first image in the post and use it as a thumbnail. Ex: `[catlist thumbnail=yes force_thumbnail=yes]`.
265
+
266
+ * **thumbnail_size** - Either a string keyword (thumbnail, medium, large or full) or 2 values representing width and height in pixels. Ex: `[catlist thumbnail_size=32,32]` or `[catlist thumbnail_size=thumbnail]`
267
+
268
+ * **thumbnail_class** - Set a CSS class for the thumbnail.
269
+
270
+ * **post_suffix** - Pass a String to this parameter to display this
271
+ String after every post title.
272
+ Ex: `[catlist numberposts=-1
273
+ post_suffix="Hello World"]` will create something like:
274
+
275
+ ```<ul class="lcp_catlist" id=lcp_instance_0>
276
+ <li>
277
+ <a href="http://127.0.0.1:8080/wordpress/?p=42" title="WordPress">
278
+ WordPress
279
+ </a> Hello World </li>```
280
+
281
+ * **display_id** - Set it to yes to show the Post's ID next to the post title: `[catlist id=3 display_id=yes]`
282
+
283
+ * **class** - CSS class for the default UL generated by the plugin.
284
+
285
+ * **tags_as_class** - Use a post's tags as a class for the `li` that lists the posts. Default is `no`. For example, `[catlist tags_as_class=yes]` will show a post that has the `fun` tag like this:
286
+ ```
287
+ <li class=" fun ">
288
+ <a href="http://localhost:8080/?p=1267" title="Post Title">Post Title</a>
289
+ </li>
290
+ ```
291
+
292
+ * **customfield_display** - Display custom field(s). You can specify
293
+ many fields to show, separating them with a coma. If you want to
294
+ display just the value and not the name of the custom field, use
295
+ `customfield_display_name` and set it to no.
296
+ By default, the custom fields will show inside a div with a
297
+ specific class: `<div class="lcp-customfield">`. You can customize
298
+ this using the customfield_tag and customfield_class parameters to
299
+ set a different tag (instead of the div) and a specific class
300
+ (instead of lcp-customfield).
301
+
302
+ * **customfield_display_glue** - Specify the text to appear between two custom
303
+ fields if displayed together, defaults to the empty string. Not used if
304
+ the `customfield_display_separately` parameter is defined.
305
+
306
+ * **customfield_display_separately** - Display the custom fields separately.
307
+ Each custom field is displayd within its own tag (see `customfield_tag`).
308
+ Defaults to 'no', set to 'yes' to enable. Superseeds the
309
+ `customfield_display_glue` parameter when enabled.
310
+
311
+ * **customfield_display_name** - To use with `customfield_display`.
312
+ Use it to just print the value of the Custom field and not the
313
+ name. Example:
314
+ `[catlist numberposts=-1 customfield_display="Mood"
315
+ customfield_display_name="no"]`
316
+ Will print the value of the Custom Field "Mood" but not the text
317
+ "Mood: [value]".
318
+
319
+ * **customfield_display_name_glue** - To use with `customfield_display_name`.
320
+ Use it to specify the text between the name and the value, defaults to
321
+ ' : '.
322
+
323
+ * **template** - By default, posts will be listed in an unordered list
324
+ (ul tag) with the class 'lcp_catlist':
325
+
326
+ `<ul class="lcp_catlist"><li><a href="post1">Post 1</a></li>...`
327
+
328
+ You can use a different class by using the *class* parameter.
329
+
330
+ You can create your own template file (Check **Template System**
331
+ further down this document) and pass it as a parameter here. The
332
+ parameter is the template name without the extension. For example
333
+ for `mytemplate.php`, the value would be `mytemplate`.
334
+
335
+ You can also pass these two parameters which yield different
336
+ results:
337
+ * `div` - This will output a div with the `lcp_catlist` class
338
+ (or one you pass as a parameter with the `class` argument). The
339
+ posts will be displayed between p tags. `[catlist template=div]`
340
+
341
+ * `ol` - This will output an ordered list with the `lcp_catlist`
342
+ css class (or the one you pass as a parameter with the `class`
343
+ argument) and each post will be a list item inside the ordered list. `[catlist template=ol]`.
344
+
345
+ * **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"]`
346
+
347
+ * **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"]`
348
+
349
+ * **link_target** - Select the `target` attribute for links to posts (target=_blank, _self, _parent, _top, *framename*). Example: `[catlink id=3 link_target=_blank]` will create: `<a href="http://localhost/wordpress/?p=45" title="Test post" target="_blank">Test post</a>`
350
+
351
+ * **no_post_titles** - If set to `yes`, no post titles will be shown. This may make sense together with `content=yes`.
352
+
353
+ * **link_titles** - Option to display titles without links. If set to `false`, the post titles won't be linking to the article.
354
+
355
+ * **link_dates** - Option to wrap dates with a link to the post. Set to `true` or `yes` to enable, set to `false` or `no` to disable. Defaults to `false`.
356
+
357
+
358
+ ==Installation==
359
+
360
+ * Upload the `list-category-posts` directory to your wp-content/plugins/ directory.
361
+ * Login to your WordPress Admin menu, go to Plugins, and activate it.
362
+ * Start using the '[catlist]` shortcode in your posts and/or pages.
363
+ * You can find the List Category Posts widget in the Appearence > Widgets section on your WordPress Dashboard.
364
+ * If you want to customize the way the plugin displays the information, check [HTML & CSS Customization](https://github.com/picandocodigo/List-Category-Posts/wiki/HTML-&-CSS-Customization) or the [section on Templates](https://github.com/picandocodigo/List-Category-Posts/wiki/Template-System) on the wiki.
365
+
366
+ == Frequently Asked Questions ==
367
+
368
+ You can find the Frequently Asked Questions [here](https://github.com/picandocodigo/List-Category-Posts/blob/master/doc/FAQ.md#frequently-asked-questions).
369
+
370
+ **INSTRUCTIONS ON HOW TO USE THE PLUGIN**
371
+
372
+ Check out [the Wiki](https://github.com/picandocodigo/List-Category-Posts/wiki/)
373
+
374
+ Please read the instructions and the FAQ before opening a new topic in the support forums.
375
+
376
+ **Widget**
377
+
378
+ The widget is quite simple, and it doesn't implement all of the plugin's functionality.
379
+
380
+ Since WordPress 4.9, you can use a shortcode in a widget. If you're using a previous WordPress version, add this code to your theme's functions.php file:
381
+
382
+ `add_filter('widget_text', 'do_shortcode');`
383
+
384
+ Then just add a new text widget to your blog and use the shortcode there as the widget's content.
385
+
386
+ **HTML & CSS Customization**
387
+
388
+ [HTML and CSS Customization](https://github.com/picandocodigo/List-Category-Posts/wiki/HTML-&-CSS-Customization)
389
+
390
+
391
+ **TEMPLATE SYSTEM**
392
+
393
+ How to customize the way the posts are shown: [Template System](https://github.com/picandocodigo/List-Category-Posts/wiki/Template-System). I am aware the Template System is not the friendliest right now, I'll work on improving this if I ever get the time to work on it.
394
+
395
+ **NEW FEATURE REQUESTS, BUG FIXES, ENHANCEMENTS**
396
+
397
+ You can post them on [GitHub Issues](https://github.com/picandocodigo/List-Category-Posts/issues).
398
+
399
+ **FURTHER QUESTIONS**
400
+
401
+ Please check the [FAQ](https://github.com/picandocodigo/List-Category-Posts/blob/master/doc/FAQ.md#frequently-asked-questions) before posting a question. You can post questions in the [Support forum](http://wordpress.org/support/plugin/list-category-posts) or [add a new issue on GitHub](https://github.com/picandocodigo/List-Category-Posts/issues).
402
+
403
+ == Upgrade Notice ==
404
+
405
+ = 0.66 =
406
+ Full release notes:
407
+ https://github.com/picandocodigo/List-Category-Posts/releases/tag/0.66
408
+
409
+ = 0.65 =
410
+ Full release notes here: https://github.com/picandocodigo/List-Category-Posts/releases/tag/0.65
411
+
412
+ = 0.37 =
413
+
414
+ 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).
415
+
416
+ = 0.34 =
417
+ * 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](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) under **HTML & CSS Customization** for more info.
418
+ * 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](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for more info).
419
+
420
+ = 0.25 =
421
+ * Translation support.
422
+
423
+ = 0.18 =
424
+ 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.
425
+
426
+ = 0.17 =
427
+ 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.
428
+
429
+ = 0.13.2 =
430
+ Thumbnail parameter 'thumbnails' changed to 'thumbnail.
431
+
432
+ = 0.7.2 =
433
+ Template system has changed. Now the posts loop must be defined inside the template. Check templates/default.php for an example.
434
+
435
+ = 0.8 =
436
+ Widget built for WordPress 2.8's Widget API, so you need at least WP 2.8 to use the widget.
437
+
438
+ = 0.9 =
439
+ Template system has changed. Custom templates should be stored in WordPress theme folder.
440
+
441
+ == Changelog ==
442
+
443
+ = 0.73 =
444
+
445
+ * Support "and" relationship for custom taxonomies, by [Dalton Rooney](https://github.com/daltonrooney).
446
+ * Support for multiple taxonomies in the same shortcode by [TheSquiffy](https://github.com/TheSquiffy)
447
+ * Tested up to WordPress 4.9
448
+ * Adds Irish translation by Jordan Silaen.
449
+
450
+ = 0.72 =
451
+
452
+ Several bug fixes:
453
+
454
+ * Makes sure the `tags_as_class` instance variable is defined. This squelched an 'undefined index' PHP Notice that appeared for widgets that were last saved before upgrading to 0.71.1. Fix by Matthew Eppelsheimer (@MatthewEppelsheimer on GitHub).
455
+ * Adds a new tutorial in the docs, check it out!
456
+ * Fixes a bug where customfield_value wouldn't work if a custom field's value = 0
457
+ * Adds tag/class html customization refactor to excerpt to behave as expected:
458
+ * If you provide `excerpt_tag` but not `excerpt_class`, excerpt will be wrapped with given tag.
459
+ * If you provide `excerpt_tag` and `excerpt_class`, excerpt will be wrapped with provided tag and given class.
460
+ * If you provide `excerpt_class` but not `excerpt_tag`, excerpt will be wrapped with a span and the given class.
461
+ * Fixes an error notice when widget is displayed for "current category" on post without category - `Notice: Undefined offset: 0 in /include/lcp-category.php on line 69`
462
+
463
+
464
+ = 0.71.1 =
465
+
466
+ * Fixes ["Undefined index: tags_as_class"](https://github.com/picandocodigo/List-Category-Posts/issues/227). Thanks @vacuus for the Pull Request! :)
467
+
468
+ = 0.71 =
469
+
470
+ * Added tags_as_class: Use a post's tags as a class for the li that lists the posts. Default is no. Thanks @vacuus on GitHub for this PR!
471
+
472
+ = 0.70 =
473
+
474
+ * Fixed [customfield_class and customfield_tag issues](https://github.com/picandocodigo/List-Category-Posts/issues/201). Thanks [vacuus](https://github.com/vacuus)!!
475
+ * Tested up to WordPress 4.6.1
476
+ * Added date range, thanks again [vacuus](https://github.com/vacuus)!! Check [the docs](https://github.com/picandocodigo/List-Category-Posts/wiki/How-to-select-which-posts-to-show) to read how to use this.
477
+
478
+ = 0.69 =
479
+
480
+ * Update lcp-widget.php for PHP 7 compatibility. Thanks @kenshin23!
481
+
482
+ = 0.68 =
483
+
484
+ Thanks @mmatthews1981, @ottadvantage and @mhoeher for their contributions on this version:
485
+
486
+ * Adds Alt Tag to thumbnail
487
+ * Handle child_categories flag correctly - https://github.com/picandocodigo/List-Category-Posts/pull/185
488
+ * Adds a default value to numberposts on plugin activation - https://github.com/picandocodigo/List-Category-Posts/pull/193
489
+
490
+
491
+ = 0.67.1 =
492
+ * Bugfix release, this should fix the issues with Parent Categories listings.
493
+
494
+ = 0.67 =
495
+ * Adds custom css class to current page in pagination `lcp_currentpage`.
496
+ * Adds child_categories parameter to being able to exclude child categories' posts from a list.
497
+ * New feature to look for the first image in a post when requesting a thumbnail and the post has no featured image. Thanks Michael J. Gibbs for writing this code :)
498
+
499
+ = 0.66 =
500
+ * Full release notes: https://github.com/picandocodigo/List-Category-Posts/releases/tag/0.66
501
+ * Orders the README a bit.
502
+ * Issues with tags when using more than one tag for OR and AND relationships should be fixed.
503
+ * Documented the use of custom taxonomies. For some reason I never came around to do that. I changed the parameters for taxonomies, it used the 'tags' parameter for 'terms' before, so I added a 'terms' parameter to make this independent from the tags parameter. So now it looks like this: `[catlist taxonomy='person' terms='bob']`. This might break some current uses of taxonomy, but since it was written so long ago and I don't know why it used "tags", I decided to just create the 'terms' parameter. People using the custom taxonomies were people who are looking at the code anyway since I can't find it documented anywhere. Sorry for the inconveniences!
504
+ * Adds category description parameter.
505
+ * Adds orderby and order to options page. Removes default values since they're the default anyway.
506
+
507
+ = 0.65 =
508
+
509
+ * Adds pagination parameter to the options page.
510
+ * Changes the loop in the default template.
511
+ * Fixes 'morelink_class not working with templates' in the default template.
512
+ * Adds link to post wrapper for the post date. If you have a chance, please thank [bibz](https://github.com/bibz) who is doing awesome Pull Requests to this plugin and occasionally helping out on the support forums here too :)
513
+
514
+ = 0.64 =
515
+
516
+ * Fixes get_current_tags
517
+ * Some updates on the documentation
518
+ * Introduces a conditional title, only displayed when posts are found, thanks [bibz](https://github.com/bibz) for this Pull Request!
519
+ * Introduces `customfield_display_separately`, `customfield_display_glue` and `customfield_display_name_glue` parameters for multiple custom fields handling by bibz. Thanks! :D
520
+
521
+ = 0.63.1 =
522
+ * Remove renamed file (Damn using subversion), should fix issues updating.
523
+
524
+ = 0.63 =
525
+
526
+ * Vagrant box and development environment improved by bibz
527
+ * Tested with WordPress 4.3, updated Widget constructor because of [PHP 4 deprecation](https://make.wordpress.org/core/2015/07/02/deprecating-php4-style-constructors-in-wordpress-4-3/).
528
+
529
+ = 0.62 =
530
+
531
+ * Dutch translation by Gerhard Hoogterp, thank you!
532
+ * Re-add the loop fixes and fixes function missing from last time by Sophist-UK, thanks!
533
+ * Allow to order by the modified date in the widget by bibz, thanks!
534
+
535
+ = 0.61 =
536
+
537
+ * Adds Portuguese from Portugal (pt_PT) translation, muito obrigado Joaquim Félix!
538
+ * Fixes translation paths, [thanks monpelaud](https://wordpress.org/support/topic/error-of-name-on-some-translation-files-1)!.
539
+
540
+
541
+ = 0.60.1 =
542
+
543
+ * Reverts switching to the loop til we find a way around for using templates.
544
+
545
+ = 0.60 =
546
+
547
+ * Fixes the loop so that other plugins work as if this was a blog or archive post.
548
+ See [issue #156](https://github.com/picandocodigo/List-Category-Posts/issues/156)
549
+ on Github. Thanks Sophist-UK for this new version :)
550
+
551
+ = 0.59.2 =
552
+
553
+ * Tested with WordPress 4.2
554
+ * Sophist's fix: Check for multi-byte functions installed and use ascii functions if not.
555
+
556
+ = 0.59.1 =
557
+
558
+ * Fix some errors
559
+
560
+ = 0.59 =
561
+
562
+ **Thanks Sophist from UK for this release** :)
563
+
564
+ By Sophist:
565
+
566
+ * Fix error causing call to undefined method
567
+ * Add excerpt=full to allow either full explicit excerpt or use <?--more--> to define where the excerpt ends.
568
+ * Fixes link_titles=false creates plain text rather than unlinked formatted text as you might expect.
569
+ * Fixes title_limit not working correctly
570
+
571
+ Other minor fixes by me.
572
+
573
+ = 0.58.1 =
574
+ * Fixes an error with pagination links. Accessing $_SERVER filtered not working on some servers, have to investigate further for a future version.
575
+ * Addresses warning messages when debug enabled.
576
+
577
+ = 0.58 =
578
+ * Removes filter interfering with filters set by other plugins. Thanks [zulkamal](https://github.com/zulkamal) for the Pull Request!
579
+ * Adds option to display titles without links. Thanks zulkamal for this Pull Request too! :D
580
+ * Workaround to prevent '?&' to appear in URLs. Thanks [mhoeher](https://github.com/mhoeher) for the Pull Request!
581
+ * General refactors for improving code quality/security.
582
+ * Fixed typo in Readme (Thanks Irma!).
583
+ * Fixes excluding tags when using category name (should fix other issues with category name too since there was a bug there).
584
+
585
+ = 0.57 =
586
+ * Add custom image sizes to the list of selectable image sizes in the widget. Thanks [nuss](https://github.com/nuss) for the Pull Request!
587
+ * New Attribute 'no_post_titles'. Thanks [thomasWeise](https://github.com/thomasWeise) for the Pull Request!
588
+ * Finnish localization. Thanks [Newman101](https://github.com/Newman101) for the Pull Request!
589
+
590
+ = 0.56 =
591
+ * Adds Indonesian (Bahasa Indonesia) translation. Thanks Dhyayi Warapsari!
592
+ * Adds french from France language. Thanks Dorian Herlory!
593
+ * Adds content=full parameter to ignore <!--more--> tags when displaying content. Thanks Sophist-UK!
594
+ * Fixes excluded_tags parameter
595
+
596
+ = 0.55 =
597
+ * Ordered lists now follow the posts count when using pagination - https://wordpress.org/support/topic/templateol-resets-count-when-using-pagination
598
+ * Fixes issue introduced in 0.54 with undefined indexes - https://wordpress.org/support/topic/problem-continues-with-0542
599
+
600
+ = 0.54.2 =
601
+ * Fixes call to undefined method lcp_get_current_post_id()
602
+
603
+ = 0.54.1 =
604
+ * Fixes bug in LcpParameters.
605
+
606
+ = 0.54 =
607
+ * Adds http/https check for pagination links.
608
+ * Fixes `post_status` and `post_type` parameters for using multiple post statuses and types.
609
+ * Big refactor: Thumbnail code, parameters moved to new class,
610
+ created util class, removed bad and repeated code, moved category
611
+ code to new class. Small fixes all around the place. Went from a
612
+ very bad 1.77 GPA to 3.23 on CodeClimate.
613
+
614
+
615
+ = 0.53 =
616
+ * Makes "starting_with" parameter accept several letters, by Diego Sorribas. Thank you!
617
+
618
+ = 0.52 =
619
+ * Small fix for pagination and query string.
620
+ * Fix on multiple categories with AND relationship.
621
+ * Fixes options page 404 and saving options.
622
+ * Tested with WordPress 4.1.
623
+
624
+ = 0.51 =
625
+ * Fixes translations, updates Spanish translation. Translators, please update your po and mo files and submit them via pull request on GitHub :)
626
+ * Test compatibility with WordPress 4.0
627
+ * Adds icon for WordPress 4.0 new plugin interface.
628
+ * Fixes posts_morelink and customfields for templates.
629
+ * Adds fixes by [htrex](https://github.com/htrex):
630
+ * Fix custom template regression
631
+ * Fix excluded categories not working in widget
632
+
633
+ = 0.50.3 =
634
+
635
+ * Addresses some warnings / scandir on Displayer and catname on widget
636
+ * Fixes lcp_paginator.css path
637
+ * Some small sanitations
638
+
639
+ = 0.50.2 =
640
+
641
+ * Small fix on templates
642
+
643
+ = 0.50.1 =
644
+
645
+ * Fixes issue with catlink.
646
+ * Fixes issue with templates named "default"
647
+
648
+ = 0.50 =
649
+
650
+ * Adds Thai translation by [itpcc](https://github.com/itpcc).
651
+ * The widget can now select an existing template. Thanks [Borjan Tchakaloff](https://github.com/bibz)!
652
+ * Templates code was refactored.
653
+
654
+ = 0.49.1 =
655
+
656
+ * Makes sure "starting_with" queries are case insesitive.
657
+ * Fixes category link on 'catlink' and 'catname' parameters (were showing twice)
658
+
659
+ = 0.49 =
660
+
661
+ * Adds `author_posts_link`, to show an author's page.
662
+ * Adds catname parameter to show just the category name (and not the link). Thanks user sirenAri from the [forum](http://wordpress.org/support/topic/a-couple-of-suggestions-and-one-teensy-error).
663
+ * Small bug fix for getting current category. Used to check against simple string, now checking against i18n'ed one.
664
+
665
+ = 0.48 =
666
+
667
+ * Bug fixes
668
+ * Adds parameter to show modified date of posts. Thanks Eric Sandine for the Pull Request :)
669
+
670
+ = 0.47 =
671
+
672
+ * Adds Ukranian translation by Michael Yunat [http://getvoip.com](http://getvoip.com/blog)
673
+ * Adds `display_id` parameter. Set it to yes to show the Post's ID next to the post title.
674
+ * Adds `starting_with` parameter. Gets posts whose title start with a given letter.
675
+
676
+
677
+ = 0.46.4 =
678
+ * Finally (hopefully) fix the excerpt issues.
679
+
680
+ = 0.46.3 =
681
+ * Fix something that I broke on previous update for excerpt :S
682
+
683
+ = 0.46.2 =
684
+ * Some fixes on displaying excerpt.
685
+
686
+ = 0.46.1 =
687
+ * Fixes quotes bug on title tag.
688
+ * Only show ellipsis when title.size > title_limit when using the
689
+ title_limit param.
690
+
691
+ = 0.46 =
692
+ * Adds "the_excerpt" filter to excerpt to improve compatibility with
693
+ the [Jetpack](http://wordpress.org/plugins/jetpack/) plugin.
694
+ * Add character limit to title
695
+ * Removes debug warnings
696
+ * Output valid HTML, attribute quotations - thanks Nikolaus Demmel!
697
+
698
+ = 0.45 =
699
+ * Adds ol default template to `template` parameter.
700
+ * Improves documentation.
701
+
702
+ = 0.44.1 =
703
+ * Removes warning when using current tag in pages
704
+ * Small fix on Readme
705
+
706
+ = 0.44 =
707
+ * Adds the feature to get an author's posts
708
+ * Adds show posts from current post's tags.
709
+
710
+ = 0.43.1 =
711
+ * Show "no posts text" only if it's been set and there are no posts,
712
+ otherwise behave like before.
713
+
714
+ = 0.43 =
715
+ * Removes filters to order by (should fix issues with order)
716
+ * Adds `pagination_prev` and `pagination_next` params to customize
717
+ the "Previous" and "Next" buttons on pagination navigation.
718
+ * Only show pages in pagination when they are > 1
719
+ * Adds `no_posts_text` param to display a custom message when no
720
+ posts are found
721
+ * Fixes "morelink" class parameter (now can be used without
722
+ specifying an HTML tag and the class is applied to the a tag).
723
+
724
+ = 0.42.3 =
725
+ * Adds missing title attribute from thumbnail links.
726
+
727
+ = 0.42.2 =
728
+ * Fixes pagination numbers
729
+ * Removes warning on wp-debug set to true
730
+
731
+ = 0.42.1 =
732
+ * Fixes some debug warnings (Ruby's nil doesn't apply in the PHP World)
733
+
734
+ = 0.42 =
735
+ * Fixes excludeposts=this.
736
+ * Adds customfield_tag and customfield_class to customize an HTML tag
737
+ and CSS class for custom fields.
738
+
739
+ = 0.41.2 =
740
+ * Small bugfix with customfield_display_name (wasn't working now it
741
+ is)
742
+
743
+ = 0.41.1 =
744
+ * Fixes customfield display name.
745
+ * Fixes size in getting thumbnails, now checks for all available
746
+ sizes and defaults ("thumbnail", "full", etc.)
747
+
748
+ = 0.41.0 =
749
+ * Adds options page, to set the default numberposts value globally.
750
+ * Adds `customfield_display_name` param.
751
+ * Adds pagination to custom template.
752
+ * Fixes date display.
753
+ * Adds conditions to Vagrantfile to boot faster and not repeat work.
754
+ * Fixes exclude posts, broken when migrating from get_posts to
755
+ WP_Query.
756
+
757
+ = 0.40.1 =
758
+
759
+ * Small fix closing quotes on content when using <!--more-->
760
+
761
+ = 0.40 =
762
+
763
+ * Tested with WordPress 3.8
764
+ * Removes unnecessary stuff on wp_enqueue_styles
765
+ * Fixes validation when using quotes in title
766
+ * Fixes on <!--more--> tag
767
+ * Fixes on title HTML tag and CSS class. (*See HTML & CSS
768
+ Customization* on [Other Notes](http://wordpress.org/plugins/list-category-posts/other_notes/) to check the expected behaviour)
769
+
770
+ = 0.39 =
771
+
772
+ * Adds "post suffix" parameter, to add a String after each post
773
+ listed. [Source](http://wordpress.org/support/topic/hack-post-title-adding-elements)
774
+
775
+ = 0.38 =
776
+
777
+ * Adds pagination. Check **Pagination** on [Other
778
+ notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/)
779
+ to learn how to use it.
780
+ * Adds "How to display thumbnails next to title" to the FAQ.
781
+ * Adds a Vagrant box for developers to be able to start coding with
782
+ no effort :)
783
+
784
+ = 0.37 =
785
+ * Supports `more` tag. If there's a &lt;!--more--&gt; tag in the post, then it will behave just as WordPress does: only show the content previous to the more tag.
786
+ * Fixes YouTube thumbnails: Includes "embed" urls for youtube video
787
+ thumbnails, makes correct img tag when using CSS class.
788
+
789
+ = 0.36.2 =
790
+
791
+ * Fixed category_count for several categories.
792
+
793
+ = 0.36.1 =
794
+
795
+ * Fixed catlink to display titles for all the categories when using more than one category.
796
+
797
+ = 0.36 =
798
+
799
+ * Adds option for "target=_blank" for post links.
800
+ * Adds option to exclude category when using the *and* relationship: `[catlist id=1+2-3]` will include posts from categories 1 and 2 but not 3.
801
+
802
+ = 0.35 =
803
+ * Updated Turkish translation, thanks again [Hakan Er](http://hakanertr.wordpress.com/)!
804
+ * Adds feature to order by custom field using the `customfield_orderby` parameter.
805
+
806
+ = 0.34.1 =
807
+ * Bugfix (removed var_dump)
808
+
809
+ = 0.34 =
810
+ * Now 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 wrap the element between span tags and the given CSS class. Check [Other notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) under **HTML & CSS Customization** for more info.
811
+ * 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](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for more info).
812
+
813
+ = 0.33 =
814
+ * Fixes bug with thumbnail size on Widget.
815
+ * Adds feature to make widget title a link to the category. Use 'catlink' as the value for the widget's title to make it a link to the category (based on https://github.com/picandocodigo/List-Category-Posts/pull/51/).
816
+ * Fixes morelink styiling with CSS class and tag.
817
+ * Adds morelink to templates (based on https://github.com/picandocodigo/List-Category-Posts/pull/48/)
818
+ * Fixes tag and CSS class for "catlink" too: http://wordpress.org/support/topic/cat_link-tag-does-not-seem-to-be-working
819
+
820
+ = 0.32 =
821
+ * Add category count parameter to show the number of posts in a category next to its title. Only works when using the **catlink** option: `[catlist name=nintendo catlink=yes category_count=yes]` - http://wordpress.org/support/topic/count-feature
822
+
823
+ = 0.31 =
824
+ * Pull request from @cfoellmann, adds testing environment and Travis CI integration. Awesomeness.
825
+ * When searching for a thumbnail, if there's no thumbnail on the post but there's a YouTube video, display the YouTube video thumbnail. (wordpress.org/support/topic/youtube-thumbnail)
826
+
827
+ = 0.30.3 =
828
+ * Bugfix release, fixes current category for post/page
829
+
830
+ = 0.30.2 =
831
+ * Improves 'current category' detection.
832
+ * Adds categorypage parameter to widget
833
+
834
+ = 0.30.1 =
835
+ * **excerpt** - Fixed default excerpt behaviour from previous release. By default it **will** strip html tags as it always did. If you want it not to strip tags, you'll have to use `excerpt_strip=no`. Added a new parameter to have a consistent excerpt. If you want to overwrite WordPress' excerpt when using the plugin and generate one the way the plugin does when there's no excerpt, use `excerpt_overwrite=yes`.
836
+
837
+ = 0.30 =
838
+ * Adds ability to exclude tags.
839
+ * 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`.
840
+
841
+ = 0.29 =
842
+ * Adds turkish translation, thanks [Hakan Er](http://hakanertr.wordpress.com/) for writing this translation! :)
843
+ * 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
844
+ * More improvements on readme.
845
+
846
+ = 0.28 =
847
+ * Improvements on readme, faqs.
848
+ * New posts_morelink param: adds a 'read more' link to each post.
849
+
850
+ = 0.27.1 =
851
+
852
+ * Sets minimum version to WordPress 3.3, since wp_trim_words was introduced in that version. Adds workaround for people using WordPress < 3.3.
853
+ * Adds Slovak translation by Branco from [WebHostingGeeks.com](http://webhostinggeeks.com/blog/).
854
+ * Removes Debug PHP warnings.
855
+ * Checkboxes on Widget save state, i18n for widget.
856
+ * Adds excerpt size to widget.
857
+
858
+ = 0.27 =
859
+
860
+ * Fixes to widget.
861
+ * Adds year and month parameters to list posts from a certain year and/or month.
862
+ * Adds search parameter to display posts that match a search term.
863
+
864
+ = 0.26 =
865
+
866
+ * Adds i18n, German and Spanish translations. All credit to [cfoellmann](https://github.com/cfoellmann) for implementing this and writing the German translation. Thanks! :)
867
+
868
+ = 0.25.1 =
869
+
870
+ * Changed excerpt limit, it uses word count, and is working for WordPress' excerpt and auto generated ones.
871
+
872
+ = 0.25 =
873
+
874
+ * Better excerpt
875
+ * Applies title filter, should work with qTranslate
876
+ * Adds post status parameter
877
+ * Adds meta links to plugin page - most importantly: INSTRUCTIONS (please read them).
878
+
879
+ = 0.24 =
880
+
881
+ * Fixes "excerpt doesn't strip shortcodes" - https://github.com/picandocodigo/List-Category-Posts/issues/5
882
+ * 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)
883
+ * Add title to category title [1](http://wordpress.stackexchange.com/questions/44467/list-category-plugin-changing-the-links), will be improved.
884
+ * Attempting to condition whitespaces to WordPress Coding Standard (emacs php-mode sucks for this...)
885
+ * 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.
886
+
887
+ = 0.23.2 =
888
+
889
+ * Bugfix release
890
+
891
+ = 0.23.1 =
892
+
893
+ * Bugfix release
894
+
895
+ = 0.23 =
896
+
897
+ This update is dedicated to [Michelle K McGinnis](http://friendlywebconsulting.com/) who bought me "Diamond Age" by Neal Stephenson from my [Amazon Wishlist](http://www.amazon.com/gp/registry/wishlist/2HU1JYOF7DX5Q/ref=wl_web). Thanks! :D
898
+
899
+ * Added excerpt size. You can set how many characters you want the excerpt to display with 'excerpt_size'.
900
+ * Fixed HTML tag and CSS class for each element (Check [Other notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for usage).
901
+ * Removed shortcodes from excerpt.
902
+
903
+ = 0.22.3 =
904
+
905
+ * Fixed thumbnail size parameter, added usage example on README.
906
+ * Added space after author and date http://wordpress.org/support/topic/plugin-list-category-posts-space-required-after
907
+
908
+ = 0.22.2 =
909
+
910
+ * Fixed bug with the categorypage=yes param.
911
+ * Tested with WordPress 3.3.
912
+
913
+ = 0.22.1 =
914
+
915
+ * Fixed accidentally deleted line which made the catlink=yes param not work.
916
+
917
+ = 0.22 =
918
+
919
+ * Added CSS "current" class hook for current post in the list: .current class attached to either the li or a tag of the currently viewed page in the said list. http://wordpress.stackexchange.com/q/35552/298
920
+ * Added *morelink* parameter, check Other notes for usage.
921
+
922
+ = 0.21.2 =
923
+
924
+ * Removed var_dump... (Sorry about that)
925
+
926
+ = 0.21.1 =
927
+
928
+ * Small fixes:
929
+ * Used "empty()" function for some Strings instead of evaluating isset() and != ''.
930
+ * Include parameters on the get_posts args only when they are set (post_parent among others).
931
+
932
+ = 0.21 =
933
+
934
+ * Added 'thumbnail_class' parameter, so you can set a CSS class to the thumbnail and style it.
935
+
936
+ = 0.20.5 =
937
+
938
+ * Brought back the multiple categories functionality for the id parameter. Hopefully the last 0.20 bugfix release so I can start working on new stuff to implement.
939
+ * Now the name parameter accepts multiple categories too. Just use: `[catlist name=category1,category2]`
940
+
941
+ = 0.20.4 =
942
+
943
+ * Yet another bugfix, regarding nothing being displayed when using tags.
944
+
945
+ = 0.20.3 =
946
+
947
+ * Fixed category detection code, which created some messy bugs in some cases
948
+
949
+ = 0.20.2 =
950
+
951
+ * Minor bugfix release
952
+
953
+ = 0.20.1 =
954
+
955
+ * Fixed extra " added to ul tag, thanks ideric (http://wordpress.org/support/topic/plugin-list-category-posts-extra-added-to-ul-tag)
956
+
957
+ = 0.20 =
958
+
959
+ * Added the possibility to list posts from the current post's category
960
+ * Some fixes to documentation
961
+
962
+ = 0.19.3 =
963
+
964
+ * Another taxonomy fix, thanks frisco! http://wordpress.org/support/topic/plugin-list-category-posts-problem-with-custom-taxonomies
965
+
966
+ = 0.19.2 =
967
+
968
+ * Small fix, missing parameter for taxonomy.
969
+
970
+ = 0.19.1 =
971
+
972
+ * Added thumbnail to Widget.
973
+ * Added thumbnail link to post (http://picod.net/33).
974
+
975
+ = 0.19 =
976
+
977
+ This update is dedicated to S. Keller from Switzerland who gave me "The Ultimate Hitchhiker's Guide to the Galaxy" from my Amazon Wishlit in appreciation for the plugin. I am really enjoying the read :D. If you, like S would like to show your appreciation, here's my [wishlist](http://www.amazon.com/gp/registry/wishlist/2HU1JYOF7DX5Q/ref=wl_web):
978
+
979
+ * Fixed private post logic, not displaying post if private. Thanks Bainternet from WordPress Answers: http://wordpress.stackexchange.com/questions/12514/list-category-posts-not-showing-posts-marked-private-to-logged-in-users/12520#12520
980
+ * Added thumbnail_size parameter.
981
+ * Added support for custom taxonomies and also moved to the array call of get_posts. Coded by wsherliker, thanks! http://picod.net/32
982
+ * Fixed widget, now it remembers saved options.
983
+
984
+ = 0.18.3 =
985
+
986
+ * Small excerpt fix, some readme file fixing too.
987
+ * Not showing the_content for password protected posts.
988
+
989
+ = 0.18.2 =
990
+
991
+ * Small fixes. Should work for name parameter in all cases now.
992
+
993
+ = 0.18.1 =
994
+
995
+ * Added slug and name to the fetching of category id from previous update.
996
+
997
+ = 0.18 =
998
+
999
+ * Fixed category id bug. Reported and fixed by Eric Celeste - http://eric.clst.org, thanks!
1000
+ * Improved template system a liitle bit, now you can pass an HTML tag and a CSS class to sorround each field on your template.
1001
+ * Added category link which wasn't working after previous big update.
1002
+
1003
+ = 0.17.1 =
1004
+
1005
+ * Fixed displaying of "Author:" even when not being called.
1006
+
1007
+ = 0.17 =
1008
+
1009
+ * Major rewrite. The whole code was rewritten using objects. It's easier now to develop for List Category Posts.
1010
+ * Both STYLESHEETPATH and TEMPLATEPATH are checked for templates.
1011
+
1012
+ = 0.16.1 =
1013
+
1014
+ * Fixed shortcode nesting.
1015
+
1016
+ = 0.16 =
1017
+
1018
+ * Changed STYLESHEETPATH to TEMPLATEPATH to point to the parent theme.
1019
+ * Added support to display custom fields. (http://picod.net/wp03)
1020
+ * Tested with WordPress 3.1 - http://wordpress.org/support/topic/399754
1021
+
1022
+
1023
+ = 0.15.1 =
1024
+
1025
+ * Fixed a bug with undeclared variable. (Check http://picod.net/walcp, thanks Das!)
1026
+
1027
+ = 0.15 =
1028
+
1029
+ * Added custom fields support. Define both custom field (customfield_name) and value (customfield_value) to use it.
1030
+
1031
+ = 0.14.1 =
1032
+
1033
+ * Fixed "Show the title of the category with a link to the category" code (catlink param), it broke on some previous update, but now it's working again. Thanks Soccerwidow on the WP Forums for pointing this out.
1034
+
1035
+ = 0.14 =
1036
+
1037
+ * Added "post_type" and "post_parent" from the underlining "get_posts()" API to be usable within the short-code. By Martin Crawford, thanks!
1038
+ * Added the "class" parameter to style the default ul. You can pass a class name, or the plugin will use "lcp_catlist" bby default. Thanks Chocolaterebel (http://wordpress.org/support/topic/plugin-list-category-posts-sharing-my-own-template-in-lcp).
1039
+ * Fixed "tags" parameter on the documentation, it used to say "tag", and the plugin looks for "tags".
1040
+
1041
+ = 0.13.2 =
1042
+
1043
+ * Fixed thumbnail code, added it to default.php template as example.
1044
+
1045
+ = 0.13.1 =
1046
+
1047
+ * Fixed broken dateformat.
1048
+
1049
+ = 0.13 =
1050
+
1051
+ * Show post thumbnails, should be tested, feedback on styling is welcome. Thanks to Sebastian from http://www.avantix.com.ar/
1052
+
1053
+ = 0.12 =
1054
+
1055
+ * Added comments count.
1056
+ * Updated readme file
1057
+
1058
+ = 0.11.2 =
1059
+
1060
+ * Another minimal bug fixed with the excerpt...
1061
+
1062
+ = 0.11.1 =
1063
+
1064
+ * Fixed small bug which made the excerpt show up everytime... (Sorry :S)
1065
+
1066
+ = 0.11 =
1067
+
1068
+ * Automatic excerpt added in case the user didn't specifically write an excerpt.
1069
+ * Widget has been finally fixed. The attributes finally save themselves, and the widget works as expected :D
1070
+
1071
+
1072
+ = 0.10.1 =
1073
+ * Small fix -
1074
+ added ul tags to default template.
1075
+ * Compatible WordPress 3.0 with Twenty Ten theme (thanks again Doug Joseph :) )
1076
+
1077
+ = 0.10 =
1078
+
1079
+ * Code for the_content was fixed so that the content to output filtered content (thanks DougJoseph http://wordpress.org/support/topic/399754)
1080
+
1081
+ = 0.9 =
1082
+
1083
+ * admin parameter now shows "display name" instead of "user nice name".
1084
+ * Template system has changed: In older version, custom templates got deleted if an automatic upgrade was done. Now templates are stored in the theme folder. (Thanks Paul Clark)
1085
+ * Added tag support
1086
+
1087
+ = 0.8.1 =
1088
+
1089
+ * Fixed bug for 'content'.
1090
+ * There's new stuff on the widget options. I'm still working on it, so some bugs may appear.
1091
+
1092
+ = 0.8 =
1093
+
1094
+ * Widget implements WP 2.8 Widget API, so at least 2.8 is required. Now you can use as many widgets as necessary, with new params.
1095
+ * Updated readme file.
1096
+
1097
+ = 0.7.2 =
1098
+
1099
+ * Fixed link to category.
1100
+ * Improved template system.
1101
+
1102
+ = 0.7.1 =
1103
+
1104
+ * Fixed uber stupid bug with offset... Sorry about that!
1105
+
1106
+ = 0.7 =
1107
+
1108
+ * Exclude posts. Contribution by acub.
1109
+ * Offset parameter on shortcode to start listing posts with an offset. Contribution by Levi Vasquez
1110
+ * Content of the post can now be displayed. Contribution by Lang Zerner.
1111
+ * Link to the category available. By request on the plugin's forum.
1112
+ * Fixed small bug when using category name.
1113
+
1114
+ = 0.6 =
1115
+
1116
+ * Minor fix for unclosed ul if not using templates.
1117
+ * Added option to list posts from many categories at once.
1118
+ * Added option to exclude categories.
1119
+
1120
+ = 0.5 =
1121
+
1122
+ * Readme.txt validation.
1123
+ * Added 'excerpt' parameter. You can now show the excerpt for each post.
1124
+ * Added 'dateformat' parameter. Format of the date output. Default is get_option('date_format') - by Verex
1125
+ * Added 'template' parameter. Now you can choose template for output of the plugin. File name of template from templates directory without extension. Example: For 'template.php' value is only 'template'. Default is 'default' that means template in code of plugin not in template file -by Verex
1126
+
1127
+ = 0.4.1 =
1128
+
1129
+ * Fixed some code to enable PHP 4 compatibility. Shouldn't hosting services update to PHP 5?
1130
+
1131
+ = 0.4 =
1132
+
1133
+ * Added 'date' parameter. Now you can show the post's date when listed.
1134
+ * Added 'author' parameter. You can also show the post's author.
1135
+ * Sidebar Widget now allows you to add a title in h2 tags.
1136
+ * Changed some variable names, to keep better compatibility with other plugins/wordpress variables.
1137
+ * Tested with Wordpress 2.7.
1138
+
1139
+ = 0.3 =
1140
+
1141
+ * Broke backwards compatibility. Users of version 0.1 should update their pages and posts for the new shortcode formatting.
1142
+ * Option to pass arguments to the plugin, in order to use name of category instead of ID, orderby, order and number of posts are passed through parameters.
1143
+
1144
+ = 0.2 =
1145
+
1146
+ * Added experimental sidebar widget (use at your own risk, not ready for prime-time yet since it hasn't been tested :P )
1147
+
1148
+ = 0.1.1 =
1149
+
1150
+ * Fixed major bug, which gave 404 error when trying to use "Options" page.
1151
+
1152
+ = 0.1 =
1153
+
1154
+ * Option page to limit number of posts.
1155
+ * Working using [category=ID] for posts and pages, with several categories support.