List category posts - Version 0.14.1

Version Description

  • 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.
Download this release

Release Info

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

Code changes from version 0.14 to 0.14.1

Files changed (2) hide show
  1. list_cat_posts.php +20 -10
  2. readme.txt +4 -1
list_cat_posts.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: List category posts
4
  Plugin URI: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
5
  Description: List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode. This shortcode accepts a category name or id, the order in which you want the posts to display, and the number of posts to display. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
- Version: 0.14
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
  */
@@ -75,6 +75,15 @@ function list_category_posts($atts){
75
  //Get the category posts:
76
  $catposts = lcp_category($lcp_category_id, $lcp_category_name, $atts);
77
 
 
 
 
 
 
 
 
 
 
78
  //Template code:
79
  $tplFileName = null;
80
  $possibleTemplates = array(
@@ -89,10 +98,13 @@ function list_category_posts($atts){
89
  if ((!empty($tplFileName)) && (is_readable($tplFileName))) {
90
  require($tplFileName);
91
  }else{
92
- $lcp_output = '<ul class="'.$atts['class'].'">';//For default ul
 
 
93
  foreach ($catposts as $single):
94
  $lcp_output .= lcp_display_post($single, $atts);
95
  endforeach;
 
96
  $lcp_output .= "</ul>";
97
  }
98
  return $lcp_output;
@@ -112,14 +124,6 @@ function lcp_category($lcp_category_id, $lcp_category_name, $atts){
112
  $category_id = $atts['id'];
113
  }
114
 
115
- //Link to the category:
116
- $cat_link_string = '';
117
- if ($atts['catlink'] == 'yes'){
118
- $cat_link = get_category_link($category_id);
119
- $cat_data = get_category($category_id);
120
- $cat_title = $cat_data->name;
121
- $cat_link_string = '<a href="' . $cat_link . '" title="' . $cat_title . '">' . $cat_title . '</a>';
122
- }
123
  //Build the query for get_posts()
124
  $lcp_query = $lcp_category.'&numberposts=' . $atts['numberposts'] .
125
  '&orderby=' . $atts['orderby'] .
@@ -135,23 +139,29 @@ function lcp_category($lcp_category_id, $lcp_category_name, $atts){
135
 
136
  function lcp_display_post($single, $atts){
137
  $lcp_output .= '<li><a href="' . get_permalink($single->ID).'">' . $single->post_title . '</a>';
 
138
  if ($atts['comments'] == yes){
139
  $lcp_output .= ' (';
140
  $lcp_output .= lcp_comments($single);
141
  $lcp_output .= ')';
142
  }
 
143
  if ($atts['date']=='yes'){
144
  $lcp_output .= lcp_showdate($single, $atts['dateformat']);
145
  }
 
146
  if ($atts['author']=='yes'){
147
  $lcp_output .= " - ".lcp_showauthor($single) . '<br/>';
148
  }
 
149
  if ($atts['content']=='yes' && $single->post_content){
150
  $lcp_output.= lcp_content($single); // line tweaked to output filtered content
151
  }
 
152
  if ($atts['excerpt']!='no' && !($atts['content']=='yes' && $single->post_content) ){
153
  $lcp_output .= lcp_excerpt($single);
154
  }
 
155
  if ($atts['thumbnail']=='yes'){
156
  $lcp_output .= lcp_thumbnail($single);
157
  }
3
  Plugin Name: List category posts
4
  Plugin URI: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
5
  Description: List Category Posts allows you to list posts from a category into a post/page using the [catlist] shortcode. This shortcode accepts a category name or id, the order in which you want the posts to display, and the number of posts to display. You can use [catlist] as many times as needed with different arguments. Usage: [catlist argument1=value1 argument2=value2].
6
+ Version: 0.14.1
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
  */
75
  //Get the category posts:
76
  $catposts = lcp_category($lcp_category_id, $lcp_category_name, $atts);
77
 
78
+ $lcp_output = '';
79
+
80
+ //Link to the category:
81
+ if ($atts['catlink'] == 'yes'){
82
+ $cat_link = get_category_link($lcp_category_id);
83
+ $cat_title = get_cat_name($lcp_category_id);
84
+ $lcp_output .= '<a href="' . $cat_link . '" title="' . $cat_title . '">' . $cat_title . '</a>';
85
+ }
86
+
87
  //Template code:
88
  $tplFileName = null;
89
  $possibleTemplates = array(
98
  if ((!empty($tplFileName)) && (is_readable($tplFileName))) {
99
  require($tplFileName);
100
  }else{
101
+ // Default template
102
+ $lcp_output .= '<ul class="'.$atts['class'].'">';
103
+
104
  foreach ($catposts as $single):
105
  $lcp_output .= lcp_display_post($single, $atts);
106
  endforeach;
107
+
108
  $lcp_output .= "</ul>";
109
  }
110
  return $lcp_output;
124
  $category_id = $atts['id'];
125
  }
126
 
 
 
 
 
 
 
 
 
127
  //Build the query for get_posts()
128
  $lcp_query = $lcp_category.'&numberposts=' . $atts['numberposts'] .
129
  '&orderby=' . $atts['orderby'] .
139
 
140
  function lcp_display_post($single, $atts){
141
  $lcp_output .= '<li><a href="' . get_permalink($single->ID).'">' . $single->post_title . '</a>';
142
+
143
  if ($atts['comments'] == yes){
144
  $lcp_output .= ' (';
145
  $lcp_output .= lcp_comments($single);
146
  $lcp_output .= ')';
147
  }
148
+
149
  if ($atts['date']=='yes'){
150
  $lcp_output .= lcp_showdate($single, $atts['dateformat']);
151
  }
152
+
153
  if ($atts['author']=='yes'){
154
  $lcp_output .= " - ".lcp_showauthor($single) . '<br/>';
155
  }
156
+
157
  if ($atts['content']=='yes' && $single->post_content){
158
  $lcp_output.= lcp_content($single); // line tweaked to output filtered content
159
  }
160
+
161
  if ($atts['excerpt']!='no' && !($atts['content']=='yes' && $single->post_content) ){
162
  $lcp_output .= lcp_excerpt($single);
163
  }
164
+
165
  if ($atts['thumbnail']=='yes'){
166
  $lcp_output .= lcp_thumbnail($single);
167
  }
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate Link: http://picandocodigo.net/programacion/wordpress/list-category-posts
4
  Tags: list, categories, posts, cms
5
  Requires at least: 2.8
6
  Tested up to: 3.0.1
7
- Stable tag: 0.14
8
 
9
  == Description ==
10
  List Category Posts is a simple WordPress plugin which allows you to list posts from a category into a post/page using the [catlist] shortcode. This shortcode accepts a category name or id, the order in which you want the posts to display, and the number of posts to display. You can use [catlist] as many times as needed with different arguments.
@@ -115,6 +115,9 @@ Template system has changed. Custom templates should be stored in wordpress them
115
 
116
  == Changelog ==
117
 
 
 
 
118
  = 0.14 =
119
  * Added "post_type" and "post_parent" from the underlining "get_posts()" API to be usable within the short-code. By Martin Crawford, thanks!
120
  * 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).
4
  Tags: list, categories, posts, cms
5
  Requires at least: 2.8
6
  Tested up to: 3.0.1
7
+ Stable tag: 0.14.1
8
 
9
  == Description ==
10
  List Category Posts is a simple WordPress plugin which allows you to list posts from a category into a post/page using the [catlist] shortcode. This shortcode accepts a category name or id, the order in which you want the posts to display, and the number of posts to display. You can use [catlist] as many times as needed with different arguments.
115
 
116
  == Changelog ==
117
 
118
+ = 0.14.1 =
119
+ * 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.
120
+
121
  = 0.14 =
122
  * Added "post_type" and "post_parent" from the underlining "get_posts()" API to be usable within the short-code. By Martin Crawford, thanks!
123
  * 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).