Category Archive plugin 0.2

Behold, version 0.2 of my category archive plugin!

Changes

  • Some type checking on the parameters passed in to the functions.
  • The addition of get_limited_category_archive(), which gets only the categories specified
  • The inclusion of a $getchildren parameter to the standard archive-getter, which allows excluding the display of child categories

Function Reference

get_category_archive($limit = 10, $parent = 0, $getchildren=true)
  • $limit is the maximum number of posts to get for a category. 0, -1, or none will get all of the posts.
  • $parent is the id of the parent category to get.
  • $getchildren specifies whether the children of the categories should be displayed
get_limited_category_archive($categories, $limit = 10)
  • $categories is the list of categories to retrieve. This can be either an array of category ids, or it can be a comma seperated list (for example: 1,2,5,7)
  • $limit is the maximum number of posts to get for each category. 0, -1 or none will get all posts.

Output

css class = categoryarchive

css class = categoryarchivename
{the name of the category}
css class = categoryarchivedesc
{the description of the category, if set}
css class = categoryarchiveposts
{the most recent postings for this category. If there are more postings than the limit specified, a link is included to the category page.}

Download
The plugin lives at http://www.neato.co.nz/plugins/category_archive.txt

Category Archive plugin

Newer version here

This is a category archive plugin. It displays a list of all categories, along with the first x posts for each category.

The plugin lives at http://www.neato.co.nz/plugins/category_archive.txt.

To install, copy the contents of that file to your plugins directory; enable the plugin; then make a call to the get_category_archive($limit, $parent) function.

$limit specifies the number of posts to get for each category; and $parent specifies the parent id. If the $parent parameter is left blank, then all of the categories will be retrieved. Alternately, if a category id is specified, only the categories under that category will be retrieved.

The output takes the form of a set of divs, with the specified CSS class names.

categoryarchive

categoryarchivename
categoryarchivedesc
categoryarchiveposts