List category posts - Version 0.65

Version Description

Full release notes here: https://github.com/picandocodigo/List-Category-Posts/releases/tag/0.65

Download this release

Release Info

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

Code changes from version 0.64 to 0.65

include/lcp-catlist.php CHANGED
@@ -96,7 +96,7 @@ class CatList{
96
 
97
  private function check_pagination($args){
98
  if ( $this->utils->lcp_not_empty('pagination') ){
99
- if( null !== $_SERVER['QUERY_STRING'] ){
100
  $query = $_SERVER['QUERY_STRING'];
101
  if ($query !== '' && preg_match('/lcp_page' . preg_quote($this->instance) .
102
  '=([0-9]+)/i', $query, $match) ) {
@@ -182,7 +182,7 @@ class CatList{
182
  if ($this->params['catlink'] == 'yes'){
183
  $cat_string = '<a href="' . $cat_link . '" title="' . $cat_title . '">' .
184
  $cat_string .
185
- $this->get_category_count($lcp_id) . '</a>';
186
  }
187
  array_push($link, $cat_string);
188
  }
@@ -207,9 +207,9 @@ class CatList{
207
 
208
 
209
 
210
- public function get_category_count($id){
211
  if($this->utils->lcp_not_empty('category_count') && $this->params['category_count'] == 'yes'):
212
- return ' (' . get_category($id)->category_count . ')';
213
  endif;
214
  }
215
 
96
 
97
  private function check_pagination($args){
98
  if ( $this->utils->lcp_not_empty('pagination') ){
99
+ if( array_key_exists('QUERY_STRING', $_SERVER) && null !== $_SERVER['QUERY_STRING'] ){
100
  $query = $_SERVER['QUERY_STRING'];
101
  if ($query !== '' && preg_match('/lcp_page' . preg_quote($this->instance) .
102
  '=([0-9]+)/i', $query, $match) ) {
182
  if ($this->params['catlink'] == 'yes'){
183
  $cat_string = '<a href="' . $cat_link . '" title="' . $cat_title . '">' .
184
  $cat_string .
185
+ $this->get_category_count() . '</a>';
186
  }
187
  array_push($link, $cat_string);
188
  }
207
 
208
 
209
 
210
+ public function get_category_count(){
211
  if($this->utils->lcp_not_empty('category_count') && $this->params['category_count'] == 'yes'):
212
+ return ' ' . get_category($this->lcp_category_id)->category_count;
213
  endif;
214
  }
215
 
include/lcp-catlistdisplayer.php CHANGED
@@ -10,6 +10,7 @@ class CatListDisplayer {
10
  private $catlist;
11
  private $params = array();
12
  private $lcp_output;
 
13
  public static function getTemplatePaths(){
14
  $template_path = TEMPLATEPATH . "/list-category-posts/";
15
  $stylesheet_path = STYLESHEETPATH . "/list-category-posts/";
@@ -148,13 +149,17 @@ class CatListDisplayer {
148
  // More link
149
  $this->lcp_output .= $this->get_morelink();
150
 
151
-
152
  $this->lcp_output .= $this->get_pagination();
153
  }
154
 
155
  public function get_pagination(){
156
  $pag_output = '';
157
- if (!empty($this->params['pagination']) && $this->params['pagination'] == "yes"):
 
 
 
 
 
158
  $lcp_paginator = '';
159
  $number_posts = $this->catlist->get_number_posts();
160
  $pages_count = ceil (
@@ -403,7 +408,13 @@ class CatListDisplayer {
403
  }
404
 
405
  private function get_date($single, $tag = null, $css_class = null){
406
- $info = " " . $this->catlist->get_date_to_show($single);
 
 
 
 
 
 
407
  return $this->assign_style($info, $tag, $css_class);
408
  }
409
 
@@ -423,6 +434,22 @@ class CatListDisplayer {
423
  return $this->assign_style($info, $tag);
424
  }
425
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
426
  // Link is a parameter here in case you want to use it on a template
427
  // and not show the links for all the shortcodes using this template:
428
  private function get_post_title($single, $tag = null, $css_class = null, $link = true){
@@ -458,18 +485,7 @@ class CatListDisplayer {
458
  return $pre . $lcp_post_title . $post;
459
  }
460
 
461
- $info = '<a href="' . get_permalink($single->ID) . '" title="' . wptexturize($single->post_title) . '"';
462
-
463
- if (!empty($this->params['link_target'])):
464
- $info .= ' target="' . $this->params['link_target'] . '" ';
465
- endif;
466
-
467
- if ( !empty($this->params['title_class'] ) &&
468
- empty($this->params['title_tag']) ):
469
- $info .= ' class="' . $this->params['title_class'] . '"';
470
- endif;
471
-
472
- $info .= '>' . $lcp_post_title . '</a>';
473
 
474
  if( !empty($this->params['post_suffix']) ):
475
  $info .= " " . $this->params['post_suffix'];
@@ -520,7 +536,7 @@ class CatListDisplayer {
520
  return $info;
521
  }
522
 
523
- private function get_category_count(){
524
  return $this->catlist->get_category_count();
525
  }
526
 
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/";
149
  // More link
150
  $this->lcp_output .= $this->get_morelink();
151
 
 
152
  $this->lcp_output .= $this->get_pagination();
153
  }
154
 
155
  public function get_pagination(){
156
  $pag_output = '';
157
+ $lcp_pag_param_present = !empty($this->params['pagination']);
158
+ if ($lcp_pag_param_present && $this->params['pagination'] == "yes" ||
159
+ # Check if the pagination option is set to true, and the param
160
+ # is not set to 'no' (since shortcode parameters should
161
+ # override general options.
162
+ (get_option('lcp_pagination') === 'true' && ($lcp_pag_param_present && $this->params['pagination'] !== 'false'))):
163
  $lcp_paginator = '';
164
  $number_posts = $this->catlist->get_number_posts();
165
  $pages_count = ceil (
408
  }
409
 
410
  private function get_date($single, $tag = null, $css_class = null){
411
+ $info = $this->catlist->get_date_to_show($single);
412
+
413
+ if ( !empty($this->params['link_dates']) && ( 'yes' === $this->params['link_dates'] || 'true' === $this->params['link_dates'] ) ):
414
+ $info = $this->get_post_link($single, $info);
415
+ endif;
416
+
417
+ $info = ' ' . $info;
418
  return $this->assign_style($info, $tag, $css_class);
419
  }
420
 
434
  return $this->assign_style($info, $tag);
435
  }
436
 
437
+ private function get_post_link($single, $text, $class = null){
438
+ $info = '<a href="' . get_permalink($single->ID) . '" title="' . wptexturize($single->post_title) . '"';
439
+
440
+ if ( !empty($this->params['link_target']) ):
441
+ $info .= ' target="' . $this->params['link_target'] . '"';
442
+ endif;
443
+
444
+ if ( !empty($class ) ):
445
+ $info .= ' class="' . $class . '"';
446
+ endif;
447
+
448
+ $info .= '>' . $text . '</a>';
449
+
450
+ return $info;
451
+ }
452
+
453
  // Link is a parameter here in case you want to use it on a template
454
  // and not show the links for all the shortcodes using this template:
455
  private function get_post_title($single, $tag = null, $css_class = null, $link = true){
485
  return $pre . $lcp_post_title . $post;
486
  }
487
 
488
+ $info = $this->get_post_link($single, $lcp_post_title, (!empty($this->params['title_class']) && empty($this->params['title_tag'])) ? $this->params['title_class'] : null);
 
 
 
 
 
 
 
 
 
 
 
489
 
490
  if( !empty($this->params['post_suffix']) ):
491
  $info .= " " . $this->params['post_suffix'];
536
  return $info;
537
  }
538
 
539
+ public function get_category_count(){
540
  return $this->catlist->get_category_count();
541
  }
542
 
include/lcp-options.php CHANGED
@@ -6,6 +6,7 @@ if ( is_admin() ){
6
 
7
  function lcp_settings() { // whitelist options
8
  register_setting( 'list_category_posts_group', 'numberposts' );
 
9
  }
10
 
11
  function list_category_posts_menu() {
@@ -21,6 +22,9 @@ function list_category_posts_options() {
21
  ?>
22
  <div class="wrap">
23
  <h2>List Category Posts</h2>
 
 
 
24
  <form method="post" action="options.php">
25
  <?php
26
  settings_fields('list_category_posts_group');
@@ -47,6 +51,21 @@ function list_category_posts_options() {
47
  </ul>
48
  </small>
49
  </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  </tbody>
51
  </table>
52
  <?php submit_button(); ?>
@@ -84,4 +103,4 @@ function list_category_posts_options() {
84
  </em>
85
  </p>
86
  </div>
87
- <?php }
6
 
7
  function lcp_settings() { // whitelist options
8
  register_setting( 'list_category_posts_group', 'numberposts' );
9
+ register_setting( 'list_category_posts_group', 'lcp_pagination' );
10
  }
11
 
12
  function list_category_posts_menu() {
22
  ?>
23
  <div class="wrap">
24
  <h2>List Category Posts</h2>
25
+ <p>
26
+ <?php _e("These are general default options for List Category Posts. The idea in general will be that you can override them using the corresponding parameters in your shortcodes.","list-category-posts")?>
27
+ </p>
28
  <form method="post" action="options.php">
29
  <?php
30
  settings_fields('list_category_posts_group');
51
  </ul>
52
  </small>
53
  </td>
54
+ </tr>
55
+
56
+ <tr valign="top">
57
+ <th scope="row">
58
+ <label for="lcp_pagination">
59
+ <strong><?php _e("Pagination", "list-category-posts"); ?> :</strong>
60
+ </label>
61
+ </th>
62
+ <td>
63
+ <select name="lcp_pagination" id="lcp_pagination">
64
+ <option value="false" <?php if(get_option('lcp_pagination') != 'true') echo 'selected="selected"' ?>>false</option>
65
+ <option value="true" <?php if(get_option('lcp_pagination') === 'true') echo 'selected="selected"' ?>>true</option>
66
+ </select>
67
+ </td>
68
+ </tr>
69
  </tbody>
70
  </table>
71
  <?php submit_button(); ?>
103
  </em>
104
  </p>
105
  </div>
106
+ <?php }
list-category-posts.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: List category posts
4
  Plugin URI: https://github.com/picandocodigo/List-Category-Posts
5
  Description: List Category Posts allows you to list posts 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.64
7
  Author: Fernando Briano
8
  Author URI: http://fernandobriano.com
9
 
@@ -126,12 +126,15 @@ class ListCategoryPosts{
126
  'no_posts_text' => "",
127
  'instance' => '0',
128
  'no_post_titles' => 'no',
129
- 'link_titles' => true
 
130
  ), $atts);
131
- if( $atts['numberposts'] == ''){
132
  $atts['numberposts'] = get_option('numberposts');
133
  }
134
- if( $atts['pagination'] == 'yes'){
 
 
135
  lcp_pagination_css();
136
  }
137
  $catlist_displayer = new CatListDisplayer($atts);
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.65
7
  Author: Fernando Briano
8
  Author URI: http://fernandobriano.com
9
 
126
  'no_posts_text' => "",
127
  'instance' => '0',
128
  'no_post_titles' => 'no',
129
+ 'link_titles' => true,
130
+ 'link_dates' => 'no',
131
  ), $atts);
132
+ if($atts['numberposts'] == ''){
133
  $atts['numberposts'] = get_option('numberposts');
134
  }
135
+ if($atts['pagination'] == 'yes' ||
136
+ (get_option('lcp_pagination') === 'true' &&
137
+ $atts['pagination'] !== 'false') ){
138
  lcp_pagination_css();
139
  }
140
  $catlist_displayer = new CatListDisplayer($atts);
readme.txt CHANGED
@@ -3,8 +3,8 @@ 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.3
7
- Stable tag: 0.64
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -13,7 +13,7 @@ License URI: http://www.gnu.org/licenses/gpl-2.0.html
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/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
 
@@ -22,17 +22,23 @@ List Category Posts allows you to list posts by category in a post/page using th
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!
 
 
 
26
 
27
- The [catlist] shortcode can be used as many times as needed with
28
- different arguments on each post/page. You can add a lot more
29
- parameters according to what and how you want to show your post's
30
- list:
31
  `[catlist id=1 numberposts=10]`
32
 
33
- There's an options page with only one option -for the moment-, new options will be implemented on demand.
 
 
 
 
 
34
 
35
- **[Please read the instructions](http://wordpress.org/extend/plugins/list-category-posts/other_notes/)** to learn which parameters are available and how to use them.
36
 
37
  If you want to **List Categories** instead of posts you can use my other plugin **[List categories](http://wordpress.org/plugins/list-categories/)**.
38
 
@@ -40,15 +46,23 @@ You can find **Frequently Asked Questions** [here](https://github.com/picandocod
40
 
41
  **Customization**
42
 
43
- The different elements to display con be styled with CSS. you can define an HTML tag to wrap the element with, and a CSS class for this tag. Check [Other Notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for usage.
44
 
45
  Great to use WordPress as a CMS, and create pages with several categories posts.
46
 
47
  **Widget**
48
 
49
- The plugin includes a widget which works pretty much the same as the plugin. Just add as many widgets as you want, and select all the available options from the Appearence > Widgets page.
 
 
 
 
50
 
51
- Please, read the information on [Other Notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) and [Changelog](http://wordpress.org/extend/plugins/list-category-posts/changelog/) to be aware of new functionality, and improvements to the plugin.
 
 
 
 
52
 
53
  **Videos**
54
 
@@ -64,21 +78,21 @@ If you've found the plugin useful, consider making a [donation via PayPal](http:
64
 
65
  **Development**
66
 
67
- I've moved the development to [GitHub](https://github.com/picandocodigo/List-Category-Posts). Fork it, code, make a pull request, suggest improvements, etc. over there. I dream of the day all of the WordPress plugins will be hosted on Github :)
68
 
69
 
70
  ==Installation==
71
 
72
- * Upload listcat directory into your wp-content/plugins/ directory.
73
  * Login to your WordPress Admin menu, go to Plugins, and activate it.
74
  * You can find the List Category Posts widget in the Appearence > Widgets section on your WordPress Dashboard.
75
  * If you want to customize the way the plugin displays the information, check the section on Templates on this documentation.
76
 
77
  ==Other notes==
78
 
79
- ==INSTRUCTIONS on how to use the plugin==
80
 
81
- ==Selecting the category==
82
  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:
83
 
84
  * Using the *category id*.
@@ -90,19 +104,20 @@ The plugin can figure out the category from which you want to list posts in seve
90
 
91
  When using List Category Posts whithout a category id, name or slug, it will post the latest posts from **every category**.
92
 
93
- ==Using more than one category==
94
 
95
  * 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]`.
96
  * 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]`.
97
  * **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.
98
 
99
- ==Pagination==
100
 
101
- To use pagination, you need to set the following parameters:
102
 
103
- * **pagination** set it to yes.
104
 
105
- * **numberposts** - Posts per page are set with the `numberposts` parameter.
 
106
 
107
  * **instance** (only necessary when using the shortcode with
108
  pagination more than once in the same page/post) - a number or
@@ -126,6 +141,8 @@ in the pagination navigation. Use the following params:
126
  * **pagination_next** - Replace the ">>" characters in the "next"
127
  button in the pagination navigation with a custom text.
128
 
 
 
129
  ==Changing the pagination CSS==
130
 
131
  If you want to customize the way the pagination is displayed, you can
@@ -134,7 +151,7 @@ theme's directory and customize it. Do not customize the file on the
134
  plugin's directory since this file will be overwritten every time you
135
  update the plugin.
136
 
137
- ==Other parameters==
138
 
139
  * **conditional_title** - Display a custom title before the posts list.
140
  The title is not displayed if the list is empty. Set to the empty string
@@ -333,7 +350,7 @@ Will print the value of the Custom Field "Mood" but not the text
333
  * **template** - By default, posts will be listed in an unordered list
334
  (ul tag) with the class 'lcp_catlist':
335
 
336
- `<ul class="lcp_catlist"><li><a href="post1">Post 1</li>...`
337
 
338
  You can use a different class by using the *class* parameter.
339
 
@@ -346,11 +363,11 @@ Will print the value of the Custom Field "Mood" but not the text
346
  results:
347
  * `div` - This will output a div with the `lcp_catlist` class
348
  (or one you pass as a parameter with the `class` argument). The
349
- posts will be displayed between p tags.
350
 
351
  * `ol` - This will output an ordered list with the `lcp_catlist`
352
  css class (or the one you pass as a parameter with the `class`
353
- argument) and each post will be a list item inside the ordered list.
354
 
355
  * **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"]`
356
 
@@ -362,6 +379,8 @@ Will print the value of the Custom Field "Mood" but not the text
362
 
363
  * **link_titles** - Option to display titles without links. If set to `false`, the post titles won't be linking to the article.
364
 
 
 
365
  == Widget ==
366
 
367
  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:
@@ -432,18 +451,34 @@ If the template file were templatename.php.
432
  You can have as many different templates as you want, and use them in different pages and posts. The template code is pretty well documented, so if you're a bit familiar with HTML and PHP, you'll have no problems creating your own template. I'm planning on reworking the template system in order to have a really user friendly way to create templates.
433
 
434
  == Frequently Asked Questions ==
435
- * **Instructions** on how to use the plugin: http://wordpress.org/extend/plugins/list-category-posts/other_notes/ - **Read it**.
436
- * **Template system** how to customize the way the posts are shown: http://wordpress.org/extend/plugins/list-category-posts/other_notes/. I am aware the Template System is not really friendly right now, I'll work on this whenever I get the time to work on the plugin for a while.
437
- * **New feature requests, Bug fixes, enhancements** - You can post them on [GitHub Issues](https://github.com/picandocodigo/List-Category-Posts/issues).
438
- * **Questions** For questions either use the [Support forum](http://wordpress.org/support/plugin/list-category-posts) or [WordPress Answers](http://wordpress.stackexchange.com/).Just [ask your question](http://wordpress.stackexchange.com/questions/ask?tags=plugin-list-category-posts) using the 'plugin-list-category-post' tag.
439
 
 
440
 
441
- * **FAQ**
442
  You can find the Frequently Asked Questions [here](https://github.com/picandocodigo/List-Category-Posts/blob/master/doc/FAQ.md#frequently-asked-questions).
443
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
444
 
445
  == Upgrade Notice ==
446
 
 
 
 
447
  = 0.37 =
448
 
449
  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).
@@ -475,6 +510,13 @@ Template system has changed. Custom templates should be stored in WordPress them
475
 
476
  == Changelog ==
477
 
 
 
 
 
 
 
 
478
  = 0.64 =
479
 
480
  * Fixes get_current_tags
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.3.1
7
+ Stable tag: 0.65
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
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
 
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://wordpress.org/plugins/list-category-posts/other_notes/)
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](http://wordpress.org/extend/plugins/list-category-posts/other_notes/)** 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
 
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 [Other Notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/) for usage.
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 [Other
62
+ Notes](http://wordpress.org/extend/plugins/list-category-posts/other_notes/)
63
+ and
64
+ [Changelog](http://wordpress.org/extend/plugins/list-category-posts/changelog/)
65
+ to be aware of new functionality, and improvements to the plugin.
66
 
67
  **Videos**
68
 
78
 
79
  **Development**
80
 
81
+ 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 :)
82
 
83
 
84
  ==Installation==
85
 
86
+ * Upload the `list-category-posts` directory to your wp-content/plugins/ directory.
87
  * Login to your WordPress Admin menu, go to Plugins, and activate it.
88
  * You can find the List Category Posts widget in the Appearence > Widgets section on your WordPress Dashboard.
89
  * If you want to customize the way the plugin displays the information, check the section on Templates on this documentation.
90
 
91
  ==Other notes==
92
 
93
+ ==Instructions on how to use the plugin==
94
 
95
+ ==SELECTING THE CATEGORY==
96
  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:
97
 
98
  * Using the *category id*.
104
 
105
  When using List Category Posts whithout a category id, name or slug, it will post the latest posts from **every category**.
106
 
107
+ ==USING MORE THAN ONE CATEGORY==
108
 
109
  * 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]`.
110
  * 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]`.
111
  * **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.
112
 
113
+ ==PAGINATION==
114
 
115
+ To use pagination, you need to set the following parameters in the shortcode:
116
 
117
+ * **pagination** set it to yes. `[catlist pagination=yes]`
118
 
119
+ * **numberposts** - Posts per page are set with the `numberposts`
120
+ parameter. `[catlist pagination=yes numberposts=5]`
121
 
122
  * **instance** (only necessary when using the shortcode with
123
  pagination more than once in the same page/post) - a number or
141
  * **pagination_next** - Replace the ">>" characters in the "next"
142
  button in the pagination navigation with a custom text.
143
 
144
+ You can also set a default value for pagination in the Options Page. This will apply every time you use the shortcode. You can override the option by using `pagination='yes'` and `pagination='no'` in the shortcode.
145
+
146
  ==Changing the pagination CSS==
147
 
148
  If you want to customize the way the pagination is displayed, you can
151
  plugin's directory since this file will be overwritten every time you
152
  update the plugin.
153
 
154
+ ==OTHER PARAMETERS==
155
 
156
  * **conditional_title** - Display a custom title before the posts list.
157
  The title is not displayed if the list is empty. Set to the empty string
350
  * **template** - By default, posts will be listed in an unordered list
351
  (ul tag) with the class 'lcp_catlist':
352
 
353
+ `<ul class="lcp_catlist"><li><a href="post1">Post 1</a></li>...`
354
 
355
  You can use a different class by using the *class* parameter.
356
 
363
  results:
364
  * `div` - This will output a div with the `lcp_catlist` class
365
  (or one you pass as a parameter with the `class` argument). The
366
+ posts will be displayed between p tags. `[catlist template=div]`
367
 
368
  * `ol` - This will output an ordered list with the `lcp_catlist`
369
  css class (or the one you pass as a parameter with the `class`
370
+ argument) and each post will be a list item inside the ordered list. `[catlist template=ol]`.
371
 
372
  * **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"]`
373
 
379
 
380
  * **link_titles** - Option to display titles without links. If set to `false`, the post titles won't be linking to the article.
381
 
382
+ * **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`.
383
+
384
  == Widget ==
385
 
386
  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:
451
  You can have as many different templates as you want, and use them in different pages and posts. The template code is pretty well documented, so if you're a bit familiar with HTML and PHP, you'll have no problems creating your own template. I'm planning on reworking the template system in order to have a really user friendly way to create templates.
452
 
453
  == Frequently Asked Questions ==
 
 
 
 
454
 
455
+ **FAQ**
456
 
 
457
  You can find the Frequently Asked Questions [here](https://github.com/picandocodigo/List-Category-Posts/blob/master/doc/FAQ.md#frequently-asked-questions).
458
 
459
+ **INSTRUCTIONS ON HOW TO USE THE PLUGIN**
460
+
461
+ http://wordpress.org/extend/plugins/list-category-posts/other_notes/ -
462
+
463
+ Please read the instructions and the FAQ before opening a new topic in the support forums.
464
+
465
+ **TEMPLATE SYSTEM**
466
+
467
+ How to customize the way the posts are shown: http://wordpress.org/extend/plugins/list-category-posts/other_notes/. I am aware the Template System is not the friendliest right now, I'll work on improving this if I ever get the time to work on it.
468
+
469
+ **NEW FEATURE REQUESTS, BUG FIXES, ENHANCEMENTS**
470
+
471
+ You can post them on [GitHub Issues](https://github.com/picandocodigo/List-Category-Posts/issues).
472
+
473
+ **FURTHER QUESTIONS**
474
+
475
+ For questions either use the [Support forum](http://wordpress.org/support/plugin/list-category-posts) or [WordPress Answers](http://wordpress.stackexchange.com/) (just [ask your question](http://wordpress.stackexchange.com/questions/ask?tags=plugin-list-category-posts) using the 'plugin-list-category-post' tag).
476
 
477
  == Upgrade Notice ==
478
 
479
+ = 0.65 =
480
+ Full release notes here: https://github.com/picandocodigo/List-Category-Posts/releases/tag/0.65
481
+
482
  = 0.37 =
483
 
484
  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).
510
 
511
  == Changelog ==
512
 
513
+ = 0.65 =
514
+
515
+ * Adds pagination parameter to the options page.
516
+ * Changes the loop in the default template.
517
+ * Fixes 'morelink_class not working with templates' in the default template.
518
+ * 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 :)
519
+
520
  = 0.64 =
521
 
522
  * Fixes get_current_tags
templates/default.php CHANGED
@@ -4,32 +4,35 @@ Plugin Name: List Category Posts - Template "Default"
4
  Plugin URI: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
5
  Description: Template file for List Category Post Plugin for Wordpress which is used by plugin by argument template=value.php
6
  Version: 0.9
7
- Author: Radek Uldrych & Fernando Briano
8
  Author URI: http://picandocodigo.net http://radoviny.net
9
  */
10
 
11
- /* Copyright 2009 Radek Uldrych (email : verex@centrum.cz), Fernando Briano (http://picandocodigo.net)
 
 
12
 
13
  This program is free software; you can redistribute it and/or modify
14
  it under the terms of the GNU General Public License as published by
15
- the Free Software Foundation; either version 3 of the License, or
16
- any later version.
17
 
18
- This program is distributed in the hope that it will be useful,
19
- but WITHOUT ANY WARRANTY; without even the implied warranty of
20
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21
- GNU General Public License for more details.
22
 
23
  You should have received a copy of the GNU General Public License
24
  along with this program; if not, write to the Free Software
25
- Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 
26
  */
27
 
28
  /**
29
- * The format for templates changed since version 0.17.
30
- * Since this code is included inside CatListDisplayer, $this refers to
31
- * the instance of CatListDisplayer that called this file.
32
- */
33
 
34
  /* This is the string which will gather all the information.*/
35
  $lcp_display_output = '';
@@ -43,68 +46,72 @@ $lcp_display_output .= $this->get_conditional_title();
43
  //Add 'starting' tag. Here, I'm using an unordered list (ul) as an example:
44
  $lcp_display_output .= '<ul class="lcp_catlist">';
45
 
46
- /**
47
- * POSTS LOOP
48
  *
49
- * The code here will be executed for every post in the category.
50
- * As you can see, the different options are being called from functions on the
51
- * $this variable which is a CatListDisplayer.
52
  *
53
- * The CatListDisplayer has a function for each field we want to show.
54
- * So you'll see get_excerpt, get_thumbnail, etc.
55
- * You can now pass an html tag as a parameter. This tag will sorround the info
56
- * you want to display. You can also assign a specific CSS class to each field.
57
- */
58
- foreach ($this->catlist->get_categories_posts() as $single){
 
 
 
59
  //Start a List Item for each post:
60
  $lcp_display_output .= "<li>";
61
 
62
  //Show the title and link to the post:
63
- $lcp_display_output .= $this->get_post_title($single, 'h4', 'lcp_post');
64
 
65
  //Show comments:
66
- $lcp_display_output .= $this->get_comments($single);
67
 
68
  //Show date:
69
- $lcp_display_output .= ' ' . $this->get_date($single);
70
 
71
  //Show date modified:
72
- $lcp_display_output .= ' ' . $this->get_modified_date($single);
73
 
74
  //Show author
75
- $lcp_display_output .= $this->get_author($single);
76
 
77
  //Custom fields:
78
- $lcp_display_output .= $this->get_custom_fields($single);
79
 
80
  //Post Thumbnail
81
- $lcp_display_output .= $this->get_thumbnail($single);
82
 
83
  /**
84
  * Post content - Example of how to use tag and class parameters:
85
  * This will produce:<p class="lcp_content">The content</p>
86
  */
87
- $lcp_display_output .= $this->get_content($single, 'p', 'lcp_content');
88
 
89
  /**
90
  * Post content - Example of how to use tag and class parameters:
91
  * This will produce:<div class="lcp_excerpt">The content</div>
92
  */
93
- $lcp_display_output .= $this->get_excerpt($single, 'div', 'lcp_excerpt');
94
-
95
 
96
  // Get Posts "More" link:
97
- $lcp_display_output .= $this->get_posts_morelink($single);
98
 
99
  //Close li tag
100
  $lcp_display_output .= '</li>';
101
- }
102
 
103
  // Close the wrapper I opened at the beginning:
104
  $lcp_display_output .= '</ul>';
105
 
106
  // If there's a "more link", show it:
107
- $lcp_display_output .= $this->catlist->get_morelink();
 
 
 
108
 
109
  //Pagination
110
  $lcp_display_output .= $this->get_pagination();
4
  Plugin URI: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
5
  Description: Template file for List Category Post Plugin for Wordpress which is used by plugin by argument template=value.php
6
  Version: 0.9
7
+ Author: Radek Uldrych & Fernando Briano
8
  Author URI: http://picandocodigo.net http://radoviny.net
9
  */
10
 
11
+ /*
12
+ Copyright 2009 Radek Uldrych (email : verex@centrum.cz)
13
+ Copyright 2009-2015 Fernando Briano (http://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 any
18
+ later version.
19
 
20
+ This program is distributed in the hope that it will be useful, but
21
+ WITHOUT ANY WARRANTY; without even the implied warranty of
22
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
23
+ 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
28
+ USA
29
  */
30
 
31
  /**
32
+ * The format for templates changed since version 0.17. Since this
33
+ * code is included inside CatListDisplayer, $this refers to the
34
+ * instance of CatListDisplayer that called this file.
35
+ */
36
 
37
  /* This is the string which will gather all the information.*/
38
  $lcp_display_output = '';
46
  //Add 'starting' tag. Here, I'm using an unordered list (ul) as an example:
47
  $lcp_display_output .= '<ul class="lcp_catlist">';
48
 
49
+ /* Posts Loop
 
50
  *
51
+ * The code here will be executed for every post in the category. As
52
+ * you can see, the different options are being called from functions
53
+ * on the $this variable which is a CatListDisplayer.
54
  *
55
+ * CatListDisplayer has a function for each field we want to show. So
56
+ * you'll see get_excerpt, get_thumbnail, etc. You can now pass an
57
+ * html tag as a parameter. This tag will sorround the info you want
58
+ * to display. You can also assign a specific CSS class to each field.
59
+ */
60
+ global $post;
61
+ while ( have_posts() ):
62
+ the_post();
63
+
64
  //Start a List Item for each post:
65
  $lcp_display_output .= "<li>";
66
 
67
  //Show the title and link to the post:
68
+ $lcp_display_output .= $this->get_post_title($post, 'h3', 'lcp_post');
69
 
70
  //Show comments:
71
+ $lcp_display_output .= $this->get_comments($post);
72
 
73
  //Show date:
74
+ $lcp_display_output .= ' ' . $this->get_date($post);
75
 
76
  //Show date modified:
77
+ $lcp_display_output .= ' ' . $this->get_modified_date($post);
78
 
79
  //Show author
80
+ $lcp_display_output .= $this->get_author($post);
81
 
82
  //Custom fields:
83
+ $lcp_display_output .= $this->get_custom_fields($post);
84
 
85
  //Post Thumbnail
86
+ $lcp_display_output .= $this->get_thumbnail($post);
87
 
88
  /**
89
  * Post content - Example of how to use tag and class parameters:
90
  * This will produce:<p class="lcp_content">The content</p>
91
  */
92
+ $lcp_display_output .= $this->get_content($post, 'p', 'lcp_content');
93
 
94
  /**
95
  * Post content - Example of how to use tag and class parameters:
96
  * This will produce:<div class="lcp_excerpt">The content</div>
97
  */
98
+ $lcp_display_output .= $this->get_excerpt($post, 'div', 'lcp_excerpt');
 
99
 
100
  // Get Posts "More" link:
101
+ $lcp_display_output .= $this->get_posts_morelink($post);
102
 
103
  //Close li tag
104
  $lcp_display_output .= '</li>';
105
+ endwhile;
106
 
107
  // Close the wrapper I opened at the beginning:
108
  $lcp_display_output .= '</ul>';
109
 
110
  // If there's a "more link", show it:
111
+ $lcp_display_output .= $this->get_morelink();
112
+
113
+ // Get category posts count
114
+ $lcp_display_output .= $this->get_category_count();
115
 
116
  //Pagination
117
  $lcp_display_output .= $this->get_pagination();