Version Description
- Minor fix for unclosed ul if not using templates.
- Added option to list posts from many categories at once.
- Added option to exclude categories.
Download this release
Release Info
Developer | fernandobt |
Plugin | List category posts |
Version | 0.6 |
Comparing to | |
See all releases |
Code changes from version 0.5 to 0.6
- list_cat_posts.php +7 -9
- readme.txt +35 -29
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.
|
7 |
Author: Fernando Briano
|
8 |
Author URI: http://picandocodigo.net/wordpress/
|
9 |
*/
|
@@ -37,7 +37,8 @@ function catlist_func($atts, $content=null) {
|
|
37 |
'author' => 'no',
|
38 |
'dateformat' => get_option('date_format'), //By Verex
|
39 |
'template' => 'default',
|
40 |
-
'excerpt' => 'no'
|
|
|
41 |
), $atts);
|
42 |
return list_category_posts($atts);
|
43 |
}
|
@@ -47,14 +48,11 @@ function list_category_posts($atts){
|
|
47 |
if($atts['name']!='default' && $atts['id']!='0'){
|
48 |
$category = 'category_name=' . $atts['name'];
|
49 |
}else{
|
50 |
-
$category = '
|
51 |
}
|
52 |
-
/*I should check this for the next version: ('category__in' => array(2,6))
|
53 |
-
to allow posts from many categories.
|
54 |
-
http://codex.wordpress.org/Template_Tags/get_posts#Parameters:_WordPress_2.6.2B */
|
55 |
//Build the query for get_posts()
|
56 |
-
$catposts = get_posts($category.'&numberposts=' .
|
57 |
-
|
58 |
'&order=' . $atts['order']);
|
59 |
|
60 |
//Template code:
|
@@ -84,7 +82,7 @@ function list_category_posts($atts){
|
|
84 |
$output.="</li>";
|
85 |
}
|
86 |
endforeach;
|
87 |
-
$output .= "</ul>";
|
88 |
return $output;
|
89 |
}
|
90 |
|
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.6
|
7 |
Author: Fernando Briano
|
8 |
Author URI: http://picandocodigo.net/wordpress/
|
9 |
*/
|
37 |
'author' => 'no',
|
38 |
'dateformat' => get_option('date_format'), //By Verex
|
39 |
'template' => 'default',
|
40 |
+
'excerpt' => 'no',
|
41 |
+
'exclude' => '0'
|
42 |
), $atts);
|
43 |
return list_category_posts($atts);
|
44 |
}
|
48 |
if($atts['name']!='default' && $atts['id']!='0'){
|
49 |
$category = 'category_name=' . $atts['name'];
|
50 |
}else{
|
51 |
+
$category = 'cat=' . $atts['id'];
|
52 |
}
|
|
|
|
|
|
|
53 |
//Build the query for get_posts()
|
54 |
+
$catposts = get_posts($category.'&numberposts=' . $atts['numberposts'] .
|
55 |
+
'&orderby=' . $atts['orderby'] .
|
56 |
'&order=' . $atts['order']);
|
57 |
|
58 |
//Template code:
|
82 |
$output.="</li>";
|
83 |
}
|
84 |
endforeach;
|
85 |
+
if(!$lcpTemplate): $output .= "</ul>"; endif;
|
86 |
return $output;
|
87 |
}
|
88 |
|
readme.txt
CHANGED
@@ -2,9 +2,9 @@
|
|
2 |
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.
|
6 |
Tested up to: 2.8.4
|
7 |
-
Stable tag: 0.
|
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.
|
@@ -24,41 +24,42 @@ Usage: [catlist argument1=value1 argument2=value2].
|
|
24 |
**Usage**
|
25 |
The arguments you can use are:
|
26 |
|
27 |
-
*
|
28 |
|
29 |
-
*
|
|
|
30 |
|
31 |
-
*
|
32 |
-
*
|
33 |
-
*
|
34 |
-
*
|
35 |
-
*
|
36 |
-
*
|
37 |
-
*
|
38 |
-
*
|
39 |
-
*
|
40 |
-
*
|
41 |
-
*
|
42 |
-
*
|
43 |
-
*
|
44 |
-
*
|
45 |
-
*
|
46 |
-
*
|
47 |
-
*
|
48 |
-
*
|
49 |
-
*
|
50 |
|
51 |
-
*
|
52 |
|
53 |
-
*
|
54 |
|
55 |
-
*
|
56 |
|
57 |
-
*
|
58 |
|
59 |
-
*
|
60 |
|
61 |
-
*
|
62 |
|
63 |
Since version 0.2, List Category Posts includes a sidebar widget. It works pretty much the same as the plugin itself.
|
64 |
|
@@ -72,6 +73,11 @@ http://picandocodigo.net/programacion/wordpress/list-category-posts-wordpress-pl
|
|
72 |
|
73 |
== Changelog ==
|
74 |
|
|
|
|
|
|
|
|
|
|
|
75 |
= 0.5 =
|
76 |
* Readme.txt validation.
|
77 |
* Added 'excerpt' parameter. You can now show the excerpt for each post.
|
2 |
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.6
|
6 |
Tested up to: 2.8.4
|
7 |
+
Stable tag: 0.6
|
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.
|
24 |
**Usage**
|
25 |
The arguments you can use are:
|
26 |
|
27 |
+
* **name** - To display posts from a category using the category's name. Ex: [catlist name=mycategory]
|
28 |
|
29 |
+
* **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 (-)
|
30 |
+
If you use both arguments (wrong!), List Category Posts will show the posts from the category in 'name'.
|
31 |
|
32 |
+
* **orderby** - To customize the order. Valid values are:
|
33 |
+
* **author** - Sort by the numeric author IDs.
|
34 |
+
* **category** - Sort by the numeric category IDs.
|
35 |
+
* **content** - Sort by content.
|
36 |
+
* **date** - Sort by creation date.
|
37 |
+
* **ID** - Sort by numeric post ID.
|
38 |
+
* **menu_order** - Sort by the menu order. Only useful with pages.
|
39 |
+
* **mime_type** - Sort by MIME type. Only useful with attachments.
|
40 |
+
* **modified** - Sort by last modified date.
|
41 |
+
* **name** - Sort by stub.
|
42 |
+
* **parent** - Sort by parent ID.
|
43 |
+
* **password** - Sort by password.
|
44 |
+
* **rand** - Randomly sort results.
|
45 |
+
* **status** - Sort by status.
|
46 |
+
* **title** - Sort by title.
|
47 |
+
* **type** - Sort by type. Ex: [catlist name=mycategory orderby=date]
|
48 |
+
* **order** - How to sort **orderby**. Valid values are:
|
49 |
+
* **ASC** - Ascending (lowest to highest).
|
50 |
+
* **DESC** - Descending (highest to lowest). Ex: [catlist name=mycategory orderby=title order=asc]
|
51 |
|
52 |
+
* **numberposts** - Number of posts to return. Set to 0 to use the max number of posts per page. Set to -1 to remove the limit. Default: 5. Ex: [catlist name=mycategory numberposts=10]
|
53 |
|
54 |
+
* **date** - Display post's date next to the title. Default is 'no', use date=yes to activate it.
|
55 |
|
56 |
+
* **author** - Display the post's author next to the title. Default is 'no', use author=yes to activate it.
|
57 |
|
58 |
+
* **dateformat** - Format of the date output. Default is get_option('date_format')
|
59 |
|
60 |
+
* **template** - 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, that's an unordered list (ul html tag) with a CSS class: 'lcp_catlist'
|
61 |
|
62 |
+
* **excerpt** - Display the post's excerpt. Default is 'no', use excerpt=yes to activate it.
|
63 |
|
64 |
Since version 0.2, List Category Posts includes a sidebar widget. It works pretty much the same as the plugin itself.
|
65 |
|
73 |
|
74 |
== Changelog ==
|
75 |
|
76 |
+
= 0.6 =
|
77 |
+
* Minor fix for unclosed ul if not using templates.
|
78 |
+
* Added option to list posts from many categories at once.
|
79 |
+
* Added option to exclude categories.
|
80 |
+
|
81 |
= 0.5 =
|
82 |
* Readme.txt validation.
|
83 |
* Added 'excerpt' parameter. You can now show the excerpt for each post.
|