WordPress Category Posts Plugin 2.0
by Brian Groce on September 5, 2008
The WordPress Category Posts plugin, version 2.0, has been released and is now available for download via the WordPress Extend Plugin Directory. WordPress Category Posts is a plugin for WordPress that creates a linked list of the posts in a specific category.
Brian Groce is a native Indianapolis resident and is the President & CEO of Watershed Studio, a web design & social media marketing firm located in the historic Stutz building in downtown Indianapolis.
Brian is also a co-founder of Indy Media School and the man behind the curtain of all things Surge Bucket Media related.
But first and foremost, Brian is the husband of his beautiful wife Amanda and the father of a house full of little ones.
Tagged as:
Open Source Software,
Watershed Studio,
WordPress,
WordPress Category Posts Plugin,
WordPress Plugins
{ 16 comments… read them below or add one }
Hallo, and thank you for this useful plugin. Is it correct, as the source code shows, that the tag wp_cat_posts does not create a list (li and /li) when wrapped like this: (ul)(?php wp_cat_posts(12); ?)(/ul)? I would like to affect each single link with my CSS-dfinitions.
Mrs_Brown,
This is currently used as a very basic display of all posts in a specific category and it is not always ideal to force it into a list. (In the future we’ll add that option, as a number of people have requested it.)
To force it into a list you’d change the code to something like this:
echo '';- ID) . '">' . $post->post_title . '
foreach( (array) $posts as $post ) {
echo '
';
}
echo '
';
And of course you could change that to suit your needs.
I’ve written a backwards-compatible patch to this plugin that will allow users to specify, via extra parameters, the number of posts they would like to display as well as how to display these posts (as before, or wrapped in a list item element like wp_get_archives() does).
How best can I submit this patch to you for inclusion in the next version of the plugin?
If anyone is interested in getting it in the mean time, you can find it, and instructions, on my website.
Hi!
Firstly, thanks for the useful plugin.
I’ve modified this one to be used as a widget too. I think widgetize it can bring lots of possibilities like brought to me.
Check out the code here: http://pastebin.com/f3a213bfe
Best regards!
G’day from Australia and many thanks for this plugin although I had to modify it slightly to work with the theme.
But I am still perplexed as how to limit the number of posts returned. Is there something in the parameters or do I have to hack the core files?
This plugin absolutely replaces the need for a sitemap, as I have set it to show on the Category page, just above the Post Extract in that specific Category.
Nice Job guys – it just needs this one little addition to make it perfect.
Dave
Gday,
What’s the line of code I have to insert?
It is not shown on the wordpress plugin page. It say to insert this line of code but then doesn’t display it.
Cheers.
Scotty Zee
I like this plugin, you can add some easy to change parmeters in the function call that will help address some of the issues that people are having. Something like
function wp_cat_posts( $catID = 0, $start = '', $end = '', $numberposts = -1, order = 'ASC', orderby = 'title' )
and replace everything in there with variables instead of hard coding it. Could possible help in the advent of adding this information in the admin panel and keep people from editing your file and risking an update messing up their websites.
i find this really great, but i wish it would post the category above it, instead of listing all posts.. is there a way of this?
I guess i ended up answering my own question.
Calling Plugin
plugin code
function wp_cat_posts( $catID = 0 ) {
$catID = (int) $catID;
$category = get_cat_name($catID);
$posts = get_posts(array(‘category’ => $catID, ‘numberposts’ => -1, ‘order’ => ASC, ‘orderby’ => title));
echo ” . $category;
foreach( (array) $posts as $post ) {
echo ‘ID) . ‘”>’ . $post->post_title . ‘‘;
}
echo ”;
}
?>
This is a nice very plugin. I just upgraded to the latest version coz the first version doesn’t work with WP 2.7.1
It’s working fine BUT how can I limit the number of results?
wp_cat_posts(#) returns all the posts in the category.
Please advice.
how do you limit the amount of post links that show up? right now it’s listing every single post in that category. I want to make it so that it’s set to only list a certain amount. Thanks.
Hi there everybody,
first of all thank you very much for that kinda good plugin, i want to list only today’s posts by date, how can i do that? i am really in need of that asap.
if you can help me i will be very
thank you from now
How to use this plugin?
ı write “wp_cat_posts(21);” in a page but not shown posts?
Hi
Is there a way to add a style to category post items from the title.
EG the title of the group is Mercury, is there any way to add class = ‘widget mercury’ to the h3 tag. Basically I need to use a new colour for each category
Thanks
Lee
I think your post above that’s supposed to tell me how to make it display as a list got garbled by wordpress it doesn’t make any sense to me… I think it tried to turn you php code into a link? not sure, anyway is there an easy way to do this or another plugin that will make a list instead of just links?
Hello, this plugin worked well but suddenly the post lit in a category is showing some strange positioning (over navigation, in an extra layer ets. Please see at http://www.healthwantednow.com/category/cancer/
Is it something in the plugin or is it something I did?
Please help!