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
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:
When using List Category Posts whithout a category id, name or slug, it will post the latest posts from every category.
tags - Tag support, you can display posts from a certain tag.
exclude_tags - Exclude posts from one or more tags:
[catlist tag="videogames" exclude_tags="sega,sony"]
orderby - To customize the order. Valid values are:
order - How to sort orderby. Valid values are:
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]
monthnum and year - List posts from a certain year or month. You can use these together or independently. Example:
[catlist year=2015] will list posts from the year 2015.
[catlist monthnum=8] will list posts published in August of every year.
[catlist year=2012 month=12] will list posts from December 2012.
search - List posts that match a search term.
[catlist search="The Cake is a lie"]
date - Display post's date next to the title. Default is 'no', use date=yes to activate it.
author - Display the post's author next to the title. Default is 'no', use author=yes to activate it.
dateformat - Format of the date output. The default format is the one you've set on your WordPress settings. Example:
[catlist id=42 dateformat="l F dS, Y"] would display the date as "Monday January 21st, 2013". Check http://codex.wordpress.org/Formatting_Date_and_Time for more options to display date.
excerpt - Display the post's excerpt. Default is 'no', use
excerpt=yes to activate it. If you don't have an excerpt in your post, the plugin will fetch this text from the content, striping its images, shortcodes and HTML tags. The limit is set by the excerpt_size parameter (55 words by default). If you want the automatically generated excerpt to respect your theme's allowed HTML tags, you should use
excerpt_strip=no. If the post has an excerpt, the HTML tags are automatically stripped. If you want to overwrite the post's excerpt with an automatically generated one (may be usefull to allow HTML tags), use
excerpt_overwrite=yes. I added this last parameter to have consistency across excerpts.
excerpt_size - Set the number of words to display from the excerpt. Default is 55. Eg:
excerpt_strip - Set it to
yes to strip the excerpt's HTML tags.
excludeposts - IDs of posts to exclude from the list. Use 'this' to exclude the current post. Ex: [catlist excludeposts=this,12,52,37]
offset - You can displace or pass over one or more initial posts which would normally be collected by your query through the use of the offset parameter.
content - Show the full content of the post. Default is 'no'. Ex: [catlist content=yes]
catlink - Show the title of the category with a link to the category. Use the catlink_string option to change the link text. Default is 'no'. Ex: [catlist catlink=yes]. The way it's programmed, it should only display the title for the first category you chose, and include the posts from all of the categories. I thought of this parameter mostly for using several shortcodes on one page or post, so that each group of posts would have the title of that group's category. If you need to display several titles with posts, you should use one [catlist] shortcode for each category you want to display.
comments - Show comments count for each post. Default is 'no'. Ex: [catlist comments=yes].
thumbnail - Show post thumbnail (http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/). Default is 'no'. Ex: [catlist thumbnail=yes].
thumbnail_size - Either a string keyword (thumbnail, medium, large or full) or 2 values representing width and height in pixels. Ex: [catlist thumbnail_size=32,32] or [catlist thumbnail_size=thumbnail]
thumbnail_class - Set a CSS class to the thumbnail and style it.
post_type - The type of post to show. Available options are: post - Default, page, attachment, any - all post types.
post_status - use post status, default value is 'publish'. Valid values:
post_parent - Show only the children of the post with this ID. Default: None.
class - CSS class for the default UL generated by the plugin.
custom fields - To use custom fields, you must specify two values: customfield_name and customfield_value. Using this only show posts that contain a custom field with this name and value. Both parameters must be defined, or neither will work.
customfield_display - Display custom field(s). You can specify many fields to show, separating them with a coma.
template - File name of template from templates directory without extension. Example: For 'template.php' value is only 'template'. Default is 'default', which displays an unordered list (ul html tag) with a CSS class. This class can be passed as a parameter or by default it's: 'lcp_catlist'. You can also use the default 'div' value. This will output a div with the 'lcp_catlist' CSS class (or one you pass as parameter with the class argument). The inner items (posts) will be displayed between p tags.
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"]
posts_morelink - Include a "read more" link after each post. It receives a string of characters as a parameter which will be used as the text of the link. Example: [catlist id=38 posts_morelink="Read more about this post"]
You can customize what HTML tags different elements will be sorrounded with and a CSS class for this element. The customizable elements are: author, catlink (category link), comments, date, excerpt, morelink ("Read More" link), thumbnail and title (post title).
The parameters are:
autor_tag, author_class, catlink_tag, catlink_class, comments_tag, comments_class, date_tag, date_class, excerpt_tag, excerpt_class, morelink_class, thumbnail_class, title_tag, title_class, posts_morelink_class
So for example, let's say you want to wrap the displayed comments count with the p tag and a "lcp_comments" class, you would do:
[catlist id=7 comments=yes comments_tag=p comments_class=lcp_comments]
This would produce the following code:
<p class="lcp_comments"> (3)</p>
Or you just want to style the displayed date, you could wrap it with a span tag:
[catlist name=blog date=yes date_tag=span date_class=lcp_date]
This would produce the following code:
<span class="lcp_date">March 21, 2011</span>
Templates for the List Category Plugin are searched for in your WordPress theme's folder. You should create a folder named list-category-posts under 'wp-content/themes/your-theme-folder'. Template files are .php files.
You can use the included template as an example to start. It's in the plugin's template folder under the name default.php. To use a template, use this code: [catlist id=1 template=templatename] If the template file were templatename.php.
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.
Requires: 3.3 or higher
Compatible up to: 3.5.1
Last Updated: 2013-4-3
6 of 61 support threads in the last two months have been resolved.
Got something to say? Need help?