List category posts - Version 0.12

Version Description

  • Added comments count.
  • Updated readme file
Download this release

Release Info

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

Code changes from version 0.11.2 to 0.12

Files changed (3) hide show
  1. list_cat_posts.php +24 -20
  2. readme.txt +14 -7
  3. templates/default.php +5 -3
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.11.2
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
  */
@@ -47,7 +47,7 @@ function catlist_func($atts, $content=null) {
47
  'tags' => '',
48
  'content' => 'no',
49
  'catlink' => 'no',
50
- 'comments' => 'no'
51
  ), $atts);
52
  return list_category_posts($atts);
53
  }
@@ -67,7 +67,7 @@ function list_category_posts($atts){
67
  $cat_link_string = '';
68
  if ($atts['catlink'] == 'yes'){
69
  $cat_link = get_category_link($category_id);
70
- $cat_data = get_category($atts['id']);
71
  $cat_title = $cat_data->name;
72
  $cat_link_string = '<a href=' . $cat_link . ' title="' . $cat_title . '">' . $cat_title . '</a>';
73
  }
@@ -100,6 +100,9 @@ function list_category_posts($atts){
100
  $lcp_output .= '<ul class="lcp_catlist">';//For default ul
101
  foreach($catposts as $single):
102
  $lcp_output .= '<li><a href="' . get_permalink($single->ID).'">' . $single->post_title . '</a>';
 
 
 
103
  if($atts['date']=='yes'){
104
  $lcp_output .= ' - ' . get_the_time($atts['dateformat'], $single);//by Verex, great idea!
105
  }
@@ -121,29 +124,30 @@ function list_category_posts($atts){
121
  }
122
 
123
  function lcp_content($single){
124
- $lcp_content = apply_filters('the_content', $single->post_content); // added to parse shortcodes
125
- $lcp_content = str_replace(']]>', ']]&gt', $lcp_content); // added to parse shortcodes
126
- return '<p>' . $lcp_content . '</p>';
127
  }
128
 
129
  function lcp_excerpt($single){
130
- if($single->post_excerpt){
131
- return '<p>' . $single->post_excerpt . '</p>';
132
- }
133
- $lcp_excerpt = strip_tags($single->post_content);
134
- if ( post_password_required($post) ) {
135
- $lcp_excerpt = __('There is no excerpt because this is a protected post.');
136
- return $lcp_excerpt;
137
- }
138
- if (strlen($lcp_excerpt) > 255) {
139
- $lcp_excerpt = substr($lcp_excerpt, 0, 252) . '...';
140
- }
141
- return '<p>' . $lcp_excerpt . '</p>';
142
  }
143
 
144
- /** TODO
145
- * -Images (preview or thumbnail, whatever, I have to dig into this
146
  * -Pagination
 
147
  * -i18n
148
  */
149
  ?>
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.12
7
  Author: Fernando Briano
8
  Author URI: http://picandocodigo.net/
9
  */
47
  'tags' => '',
48
  'content' => 'no',
49
  'catlink' => 'no',
50
+ 'comments' => 'no'
51
  ), $atts);
52
  return list_category_posts($atts);
53
  }
67
  $cat_link_string = '';
68
  if ($atts['catlink'] == 'yes'){
69
  $cat_link = get_category_link($category_id);
70
+ $cat_data = get_category($category_id);
71
  $cat_title = $cat_data->name;
72
  $cat_link_string = '<a href=' . $cat_link . ' title="' . $cat_title . '">' . $cat_title . '</a>';
73
  }
100
  $lcp_output .= '<ul class="lcp_catlist">';//For default ul
101
  foreach($catposts as $single):
102
  $lcp_output .= '<li><a href="' . get_permalink($single->ID).'">' . $single->post_title . '</a>';
103
+ if($atts['comments'] == yes){
104
+ $lcp_output .= ' (' . $single->comment_count . ')';
105
+ }
106
  if($atts['date']=='yes'){
107
  $lcp_output .= ' - ' . get_the_time($atts['dateformat'], $single);//by Verex, great idea!
108
  }
124
  }
125
 
126
  function lcp_content($single){
127
+ $lcp_content = apply_filters('the_content', $single->post_content); // added to parse shortcodes
128
+ $lcp_content = str_replace(']]>', ']]&gt', $lcp_content); // added to parse shortcodes
129
+ return '<p>' . $lcp_content . '</p>';
130
  }
131
 
132
  function lcp_excerpt($single){
133
+ if($single->post_excerpt){
134
+ return '<p>' . $single->post_excerpt . '</p>';
135
+ }
136
+ $lcp_excerpt = strip_tags($single->post_content);
137
+ if ( post_password_required($post) ) {
138
+ $lcp_excerpt = __('There is no excerpt because this is a protected post.');
139
+ return $lcp_excerpt;
140
+ }
141
+ if (strlen($lcp_excerpt) > 255) {
142
+ $lcp_excerpt = substr($lcp_excerpt, 0, 252) . '...';
143
+ }
144
+ return '<p>' . $lcp_excerpt . '</p>';
145
  }
146
 
147
+ /** TODO - These are the todo's for a 1.0 release:
148
+ * -Images (preview or thumbnail, whatever, I have to dig into this)
149
  * -Pagination
150
+ * -Simplify template system
151
  * -i18n
152
  */
153
  ?>
readme.txt CHANGED
@@ -4,12 +4,14 @@ 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
7
- Stable tag: 0.11.2
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. Great to use WordPress as a CMS, and create pages with several categories posts.
11
 
12
- Since version 0.8, the sidebar widget has been migrated to WordPress 2.8 Widget API, so you can use as many widgets as you like. The widget has the same functionallity as the plugin, but you can customize its options on the Appearence > Widgets section.
 
 
13
 
14
  Compatible with WordPress 3.0 and default Twenty Ten theme (http://wordpress.org/support/topic/399754)
15
 
@@ -77,16 +79,17 @@ If you use both arguments (wrong!), List Category Posts will show the posts from
77
 
78
  * **content** - Show the full content of the post. Default is 'no'. Ex: [catlist content=yes]
79
 
80
- * **catlink** - Show the link to the category. Use the template system to customize its display using the variable $cat_link_string. Default is 'no'. Ex: [catlist catlink=yes].
81
 
82
- Since version 0.2, List Category Posts includes a sidebar widget. It works pretty much the same as the plugin itself.
83
 
84
- Your comments and feedback are welcome at: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
85
 
86
- **New Code is welcome** :D
87
 
88
  == Frequently Asked Questions ==
89
  * **Instructions** on how to use the plugin: http://foro.picandocodigo.net/viewtopic.php?f=28&t=251
 
90
  * **Support forum** & **New feature requests**: http://foro.picandocodigo.net/viewforum.php?f=28
91
 
92
  == Upgrade Notice ==
@@ -102,6 +105,10 @@ Template system has changed. Custom templates should be stored in wordpress them
102
 
103
  == Changelog ==
104
 
 
 
 
 
105
  = 0.11.2 =
106
  * Another minimal bug fixed with the excerpt...
107
 
4
  Tags: list, categories, posts, cms
5
  Requires at least: 2.8
6
  Tested up to: 3.0
7
+ Stable tag: 0.12
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.
11
 
12
+ Great to use WordPress as a CMS, and create pages with several categories posts.
13
+
14
+ 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.
15
 
16
  Compatible with WordPress 3.0 and default Twenty Ten theme (http://wordpress.org/support/topic/399754)
17
 
79
 
80
  * **content** - Show the full content of the post. Default is 'no'. Ex: [catlist content=yes]
81
 
82
+ * **catlink** - Show the title of the category with a link to the category. Use the template system to customize its display using the variable $cat_link_string. Default is 'no'. Ex: [catlist catlink=yes].
83
 
84
+ * **comments** - Show comments count for each post. Default is 'no'. Ex: [catlist comments=yes].
85
 
86
+ Your comments and feedback are welcome at: http://foro.picandocodigo.net/viewforum.php?f=28
87
 
88
+ **New Code is welcome too** :D
89
 
90
  == Frequently Asked Questions ==
91
  * **Instructions** on how to use the plugin: http://foro.picandocodigo.net/viewtopic.php?f=28&t=251
92
+ * **Template system** how to customize the way the posts are shown: http://foro.picandocodigo.net/viewtopic.php?f=28&t=253
93
  * **Support forum** & **New feature requests**: http://foro.picandocodigo.net/viewforum.php?f=28
94
 
95
  == Upgrade Notice ==
105
 
106
  == Changelog ==
107
 
108
+ = 0.12 =
109
+ * Added comments count.
110
+ * Updated readme file
111
+
112
  = 0.11.2 =
113
  * Another minimal bug fixed with the excerpt...
114
 
templates/default.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: List Category Posts - Template
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.6.1
7
  Author: Radek Uldrych & Fernando Briano
8
  Author URI: http://picandocodigo.net http://radoviny.net
9
  */
@@ -35,6 +35,10 @@ $lcp_output .= '<ul class="lcp_catlist">';//For default ul
35
  //Posts loop:
36
  foreach($catposts as $single):
37
  $lcp_output .= '<li><a href="' . get_permalink($single->ID) . '">' . $single->post_title . '</a>';
 
 
 
 
38
  //Style for date:
39
  if($atts['date']=='yes'){
40
  $lcp_output .= ' - ' . get_the_time($atts['dateformat'], $single);
@@ -57,6 +61,4 @@ foreach($catposts as $single):
57
  $lcp_output .='</li>';
58
  endforeach;
59
  $lcp_output .= '</ul>';
60
-
61
-
62
  ?>
3
  Plugin Name: List Category Posts - Template
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.8
7
  Author: Radek Uldrych & Fernando Briano
8
  Author URI: http://picandocodigo.net http://radoviny.net
9
  */
35
  //Posts loop:
36
  foreach($catposts as $single):
37
  $lcp_output .= '<li><a href="' . get_permalink($single->ID) . '">' . $single->post_title . '</a>';
38
+ //Show comments?
39
+ if($atts['comments'] == yes){
40
+ $lcp_output .= ' (' . $single->comment_count . ')';
41
+ }
42
  //Style for date:
43
  if($atts['date']=='yes'){
44
  $lcp_output .= ' - ' . get_the_time($atts['dateformat'], $single);
61
  $lcp_output .='</li>';
62
  endforeach;
63
  $lcp_output .= '</ul>';
 
 
64
  ?>