List category posts - Version 0.9

Version Description

Template system has changed. Custom templates should be stored in wordpress theme folder.

=

Download this release

Release Info

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

Code changes from version 0.8.1 to 0.9

lcp_widget_form.php CHANGED
@@ -41,7 +41,7 @@ $instance = wp_parse_args( (array) $instance, array( 'title' => '',
41
  $categoryid = strip_tags($instance['categoryid']);
42
 
43
  ?>
44
- <?php var_dump($instance);?>
45
  <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <br/>
46
  <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
47
  name="<?php echo $this->get_field_name('title'); ?>" type="text"
41
  $categoryid = strip_tags($instance['categoryid']);
42
 
43
  ?>
44
+ <?php //var_dump($instance);?>
45
  <p><label for="<?php echo $this->get_field_id('title'); ?>">Title: <br/>
46
  <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>"
47
  name="<?php echo $this->get_field_name('title'); ?>" type="text"
list_cat_posts.php CHANGED
@@ -3,9 +3,9 @@
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.8.1
7
  Author: Fernando Briano
8
- Author URI: http://fernandobriano.com/
9
  */
10
 
11
  /* Copyright 2008-2010 Fernando Briano (email : fernando@picandocodigo.net)
@@ -27,8 +27,6 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27
 
28
  //Sidebar Widget:
29
  include('list_cat_posts_widget.php');
30
- //Filters and actions:
31
- //add_action('plugins_loaded', 'lcp_load_widget');
32
 
33
  //Shortcode [catlist parameter="value"]
34
  function catlist_func($atts, $content=null) {
@@ -46,6 +44,7 @@ function catlist_func($atts, $content=null) {
46
  'exclude' => '0',
47
  'excludeposts' => '0',
48
  'offset' => '0',
 
49
  'content' => 'no',
50
  'catlink' => 'no'
51
  ), $atts);
@@ -75,9 +74,20 @@ function list_category_posts($atts){
75
  '&orderby=' . $atts['orderby'] .
76
  '&order=' . $atts['order'] .
77
  '&exclude=' . $atts['excludeposts'] .
 
78
  '&offset=' . $atts['offset'] );
79
  //Template code:
80
- $tplFileName = $atts['template'] != 'default'?dirname(__FILE__).'/templates/'.$atts['template'].'.php' : null;
 
 
 
 
 
 
 
 
 
 
81
  if ((!empty($tplFileName)) && (is_readable($tplFileName))) {
82
  require($tplFileName);
83
  }else{
@@ -94,7 +104,7 @@ function list_category_posts($atts){
94
  }
95
  if($atts['author']=='yes'){
96
  $lcp_userdata = get_userdata($single->post_author);
97
- $output.=" - ".$lcp_userdata->user_nicename . '<br/>';
98
  }
99
  if($atts['content']=='yes' && $single->post_content){
100
  $output .= "<p>$single->post_content</p>";
@@ -113,4 +123,8 @@ function lcp_add_option_page(){
113
  add_options_page('List Category Posts', 'List Category Posts', 'manage_options','list-category-posts/list_cat_posts_options.php');
114
  }
115
 
 
 
 
 
116
  ?>
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.9
7
  Author: Fernando Briano
8
+ Author URI: http://picandocodigo.net/
9
  */
10
 
11
  /* Copyright 2008-2010 Fernando Briano (email : fernando@picandocodigo.net)
27
 
28
  //Sidebar Widget:
29
  include('list_cat_posts_widget.php');
 
 
30
 
31
  //Shortcode [catlist parameter="value"]
32
  function catlist_func($atts, $content=null) {
44
  'exclude' => '0',
45
  'excludeposts' => '0',
46
  'offset' => '0',
47
+ 'tags' => '',
48
  'content' => 'no',
49
  'catlink' => 'no'
50
  ), $atts);
74
  '&orderby=' . $atts['orderby'] .
75
  '&order=' . $atts['order'] .
76
  '&exclude=' . $atts['excludeposts'] .
77
+ '&tag=' . $atts['tags'] .
78
  '&offset=' . $atts['offset'] );
79
  //Template code:
80
+ $tplFileName = null;
81
+ $possibleTemplates = array(
82
+ // File locations lower in list override others
83
+ dirname(__FILE__).'/templates/'.$atts['template'].'.php',
84
+ STYLESHEETPATH.'/list-category-posts/'.$atts['template'].'.php',
85
+ );
86
+ foreach($possibleTemplates as $key => $file) {
87
+ if (is_readable($file)) {
88
+ $tplFileName = $file;
89
+ }
90
+ }
91
  if ((!empty($tplFileName)) && (is_readable($tplFileName))) {
92
  require($tplFileName);
93
  }else{
104
  }
105
  if($atts['author']=='yes'){
106
  $lcp_userdata = get_userdata($single->post_author);
107
+ $output.=" - ".$lcp_userdata->display_name . '<br/>';
108
  }
109
  if($atts['content']=='yes' && $single->post_content){
110
  $output .= "<p>$single->post_content</p>";
123
  add_options_page('List Category Posts', 'List Category Posts', 'manage_options','list-category-posts/list_cat_posts_options.php');
124
  }
125
 
126
+ /** TODO
127
+ * -Add auto excerpt
128
+ * -Images (preview or thumbnail, whatever, I have to dig into this
129
+ */
130
  ?>
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: fernandobt
3
  Donate Link: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
4
  Tags: list, categories, posts, cms
5
  Requires at least: 2.8
6
- Tested up to: 2.9.1
7
- Stable tag: 0.8.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. Great to use WordPress as a CMS, and create pages with several categories posts.
@@ -32,6 +32,8 @@ The arguments you can use are:
32
  * **id** - To display posts from a category using the category's id. Ex: [catlist id=24]. You can **include several categories**: Ex: [catlist id=17,24,32] or **exclude** a category with the minus (-)
33
  If you use both arguments (wrong!), List Category Posts will show the posts from the category in 'name'.
34
 
 
 
35
  * **orderby** - To customize the order. Valid values are:
36
  * **author** - Sort by the numeric author IDs.
37
  * **category** - Sort by the numeric category IDs.
@@ -48,7 +50,8 @@ If you use both arguments (wrong!), List Category Posts will show the posts from
48
  * **status** - Sort by status.
49
  * **title** - Sort by title.
50
  * **type** - Sort by type. Ex: [catlist name=mycategory orderby=date]
51
- * **order** - How to sort **orderby**. Valid values are:
 
52
  * **ASC** - Ascending (lowest to highest).
53
  * **DESC** - Descending (highest to lowest). Ex: [catlist name=mycategory orderby=title order=asc]
54
 
@@ -79,9 +82,8 @@ Your comments and feedback are welcome at: http://picandocodigo.net/programacion
79
  **New Code is welcome** :D
80
 
81
  == Frequently Asked Questions ==
82
- * **Instructions** on how to use the plugin: http://wordpress.org/extend/plugins/list-category-posts/other_notes/
83
- * **Support forum** on the following URL: http://foro.picandocodigo.net/viewtopic.php?f=27&t=221
84
- * **New feature requests** on the following URL: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
85
 
86
  == Upgrade Notice ==
87
 
@@ -91,9 +93,16 @@ Template system has changed. Now the posts loop must be defined inside the templ
91
  = 0.8 =
92
  Widget built for WordPress 2.8's Widget API, so you need at least WP 2.8 to use the widget.
93
 
 
 
94
 
95
  == Changelog ==
96
 
 
 
 
 
 
97
  = 0.8.1 =
98
  * Fixed bug for 'content'.
99
  * There's new stuff on the widget options. I'm still working on it, so some bugs may appear.
3
  Donate Link: http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-plugin-english/
4
  Tags: list, categories, posts, cms
5
  Requires at least: 2.8
6
+ Tested up to: 2.9.2
7
+ Stable tag: 0.9
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.
32
  * **id** - To display posts from a category using the category's id. Ex: [catlist id=24]. You can **include several categories**: Ex: [catlist id=17,24,32] or **exclude** a category with the minus (-)
33
  If you use both arguments (wrong!), List Category Posts will show the posts from the category in 'name'.
34
 
35
+ * **tag** - Tag support, you can display posts from a certain tag.
36
+
37
  * **orderby** - To customize the order. Valid values are:
38
  * **author** - Sort by the numeric author IDs.
39
  * **category** - Sort by the numeric category IDs.
50
  * **status** - Sort by status.
51
  * **title** - Sort by title.
52
  * **type** - Sort by type. Ex: [catlist name=mycategory orderby=date]
53
+
54
+ * **order** - How to sort **orderby**. Valid values are:
55
  * **ASC** - Ascending (lowest to highest).
56
  * **DESC** - Descending (highest to lowest). Ex: [catlist name=mycategory orderby=title order=asc]
57
 
82
  **New Code is welcome** :D
83
 
84
  == Frequently Asked Questions ==
85
+ * **Instructions** on how to use the plugin: http://foro.picandocodigo.net/viewtopic.php?f=28&t=251
86
+ * **Support forum** & **New feature requests**: http://foro.picandocodigo.net/viewforum.php?f=28
 
87
 
88
  == Upgrade Notice ==
89
 
93
  = 0.8 =
94
  Widget built for WordPress 2.8's Widget API, so you need at least WP 2.8 to use the widget.
95
 
96
+ = 0.9 =
97
+ Template system has changed. Custom templates should be stored in wordpress theme folder.
98
 
99
  == Changelog ==
100
 
101
+ = 0.9 =
102
+ * admin parameter now shows "display name" instead of "user nice name".
103
+ * 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)
104
+ * Added tag support - http://foro.picandocodigo.net/viewtopic.php?f=28&t=240
105
+
106
  = 0.8.1 =
107
  * Fixed bug for 'content'.
108
  * There's new stuff on the widget options. I'm still working on it, so some bugs may appear.
templates/README ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ Templates for the List Category Plugin are searched for in your WordPress theme's folder.
2
+ You should create a folder named "list-category-posts" under [i]wp-content/themes/your-theme-folder[/i].
3
+
4
+ Template files are .php files. You can use the included template as an example to start.
5
+ You can find it in the plugin's template folder under the name default.php. To use a template, use this code:
6
+ [catlist id=1 template=default]
7
+ If the template file is default.php.
8
+ You can have as many different templates as you want, and use them in different pages and posts.
9
+
10
+ More info / help:
11
+ http://foro.picandocodigo.net/viewtopic.php?f=28&t=253
templates/default.php CHANGED
@@ -31,6 +31,7 @@ if ($cat_link_string != ''){
31
  }else{
32
  $output = '';
33
  }
 
34
  //Posts loop:
35
  foreach($catposts as $single):
36
  $output .= '<li><a href="' . get_permalink($single->ID) . '">' . $single->post_title . '</a>';
@@ -41,7 +42,7 @@ foreach($catposts as $single):
41
  //Show author?
42
  if($atts['author']=='yes'){
43
  $lcp_userdata = get_userdata($single->post_author);
44
- $output.=" - ".$lcp_userdata->user_nicename;
45
  }
46
  //Show content?
47
  if($atts['content']=='yes' && $single->post_content){
31
  }else{
32
  $output = '';
33
  }
34
+ $output .= 'Using template';
35
  //Posts loop:
36
  foreach($catposts as $single):
37
  $output .= '<li><a href="' . get_permalink($single->ID) . '">' . $single->post_title . '</a>';
42
  //Show author?
43
  if($atts['author']=='yes'){
44
  $lcp_userdata = get_userdata($single->post_author);
45
+ $output.=" - ".$lcp_userdata->display_name;
46
  }
47
  //Show content?
48
  if($atts['content']=='yes' && $single->post_content){