Archives for a category, version 1.3 Description =========== Adds a cat parameter to wp_get_archives() to limit the posts used to generate the archive links to one or more categories. Installation ============ 1. Put this file in your WordPress plugin directory, /wp-content/plugins. 2. Activate the plugin 'Archives for a category' on the Plugin Management page of the WordPress administration panel. 3. Optionally disable the canonical URLs from the menu Options | Kwebble. Usage ===== After installing and activating the plugin the wp_get_archives() function accepts a 'cat' parameter. Its value must be one or more category ID's, separated by comma's, of the categories to include in building the list of archives. For example, to show the default monthly list of archives for category 1 put this in a template: The same list, but with posts from categories 1 and 3: To create a list of archives for category 1 as a dropdown box use: For a complete description of all parameters see the documentation of wp_get_archives(). Now you need to make sure the template used to show each archive displays posts from the selected category. I'm using category specific templates on this site, like category-id where id is the ID of the category to display. You can use other templates in the template hierarchy, but make sure the template shows items of that category. Limitations =========== This plugin does not work for weekly archives. The list with archive links is correct, but the links themselves do not include the category. So when used, WordPress will not filter the resulting page on the category. The technical reason is that WordPress does not apply filters when the links for weekly archives are generated, so the plugin can't change them. Perhaps this is fixed in a next version of WordPress. A WordPress feature added in version 2.3, called canonical URLs, redirects browsers on certain URLs. This also happens with the URLs for the archives with a cat parameter. This causes the archive pages to contain posts which do not belong to the selected period. To solve this problem the plugin can disable canonical URLs. Go to the administration section of your blog, choose the Options tab and then the Kwebble subtab. On that page you will find a setting to disable canonical URLs. This is using the same technique used in the Disable Canonical URL Redirection plugin Mark Jaquith made. This plug-in was developed and tested to work correctly with WordPress versions 2.2.1 and 2.3.1. It probably also works with 2.3. and 2.3.2. History ======= Version 1.0 - Initial version, works with WordPress 2.2.1. Version 1.2 - Added support for WordPress 2.3.1. Version 1.3 - Added support for multiple categories. Copyright ========= Copyright 2007, 2008 Rob Schlüter. All rights reserved. Licensing terms =============== - You may use, change and redistribute this software provided the copyright notice above is included. - This software is provided without warranty, you use it at your own risk.