WordPress Category Archive Widget Plugin

Introduction

The WordPress Category Archive Widget displays a monthly or yearly archive of posts for one specific category. It is very similar to the WordPress Archive Widget except that it just displays one specific category’s posts, not all categories. It can be configured to either show a listing or pulldown by month or year with or without post counts.

Download

Screenshots

Category Archive Options

From the Category Archive widget control, you can set the widget’s title, category, whether to display the archive as lines or as an unordered list or as a pulldown, whether to group by month or year and whether to show post counts.

Category Archive Display

The archive displayed as a list with post counts and the archive as a pulldown of years without post counts.

Installation

  1. Upload “wp-category-archive.php” to the “/wp-content/plugins/” directory.
  2. Activate the plugin through the “Plugins” menu in WordPress.
  3. From the “Widgets” page in WordPress drag the “Cateogry Archive” widget to the “Sidebar”.
  4. Configure the “Category Archive” widget controls, setting the “Title”, “Category”, “Display Style”, “Group By” and “Show Post Counts” fields.

FAQ

How is the Cateogry Archive widget different than the built-in Archive widget?
The Category Archive widget lets you show posts for one specific category. The built-in Archive widget shows posts for all categories.

How come with permalinks on, when clicking on a month link, posts are shown for other months or other categories?
If permalinks are on, the permalink structure must contain the category, year and month for the Category Archive widget to work properly (e.g. /%category%/%year%/%monthnum%/%post_id%/).

With WordPress 3.0, you may also need to update the redirect_canonical function in wp-includes/canonical.php. See the “Permalink rewriting in 3.0″ support topic for more info.

Change Log

1.3.0

  • Added better support for permalinks.
  • Internationalized the month names.

1.2.0

  • Added options to show post counts and display as an unordered list.

1.1.0

  • Added option to display by month or year.

1.0.0

  • Displays monthly archive of posts for one specific category.

67 Responses to “WordPress Category Archive Widget Plugin”

  1. hugh says:

    It uses the date_i18n() function, so if you have wp_locale set correctly, it should show the month names in Spanish. Otherwise you will need to update the code.

    http://codex.wordpress.org/Function_Reference/date_i18n

  2. I need to display a category archive for various distinct categories. However, the widget is hardcoded to show posts from one category only. Is there a way to use the plugin in the template code via do_action()? Or is the only way really to add a separate sidebar for each category? My client might be adding or removing categories in the future, so this would always require some manual labour. :P

  3. CWAA says:

    Hi,

    Is there a way to define what widgets/sidebar appear in the generated archive pages? I have many different sidebar menus and widgets and would like different ones to appear depending on the category archive that is selected.

    I have two different categories I am using this plugin in for and I would like different sidebars to appear within the two different category archive pages.

  4. jeFFF says:

    Hello,

    Thanks for this plugin, it saved me as I needed this function on a customer web site.
    I did just a slight modification I would like to submit to you, I needed to get archives form the current category, I did it by adding this :
    line 91 : [code]$category_id = ($category_id == (int)0) ? get_query_var('cat') : $category_id;[/code]

    and this :
    line 256 : [code]echo '0 : '.__('Current category').'';[/code]

    Hope you find this useful, feel free to add it in a future release.

    Cheers,
    jeFFF

  5. Toni says:

    I need pass with URL of month the language ?lang=es
    How I’ll implement ? I using qtraslate.

  6. Phil says:

    Hi,

    Thanks for this great Plugin

    can i ask – is it possible to adjust the plugin so I can enter the ID for more than 1 CATEGORY in the slect category box?

    At present it looks like I can only select 1 Category Archive?

    thanks

    Phil

  7. kevin says:

    Hi, i just saw a bug. I got the widget in my sidebar, working well as long as i don’t publish posts in the past with the “Schedule” option. There the posts do appear in my page, but not in the widget’s archives list. Any clue?

  8. kevin says:

    Edit: just did a test with the regular archives widget and the older dates do appear fine as i publish in the past. So it’s really an issue with the plugin. Thanks in advance.

  9. Courtney says:

    Is it possible to get the PHP code for manual placement in templates, as opposed to using the widget? Thanks.

  10. Courtney says:

    P.S. I was hoping that I could use a subset of the URL you mention —

    /%category%/%year%/%monthnum%/%post_id%/

    – and just create URLs to /%category%/%year%/%monthnum%/

    However, this doesn’t work. Should it?

  11. hugh says:

    I think you need either the %post_id% or the %postname% somewhere in the permalink.

  12. Ann P. says:

    Hi Hugh,

    I am trying your plugin on a 3.3.1 WP installation. I changes my permalinks to a custom stucture to include the category:
    /%postname%/%category%/%year%/%monthnum%/
    The custom archive comes up in the sidebar but when I click on a month it says Page Not Found. Any idea as to what I am doing wrong?

    This is the page I have it activated on:
    http://xbm-wptestsite.com/hearts1/category/h-and-w-blog/

    Thanks.

  13. ryan says:

    This is a great widget. It’s working perfectly on my site. Is there anyway to apply a current menu item to the output?

    right now I have my years listed, 2009, 2008…..

    when you click on 2008, I’d love to either have a title that says 2008 or have a class on the 2008 link so I can change it’s color. Any way to do this?

  14. hugh says:

    You could use JavaScript. Here is some code that uses JQuery to add the class “highlighted” to the link in the category archive whose href matches the current page’s href.

    <script src="http://code.jquery.com/jquery-1.7.2.js" type="text/javascript"></script>
    <script type="text/javascript">
    $(document).ready(function() {
    var href = window.location.href;
    $(".widget_wp-category-archive a[href='" + href + "']").addClass("highlighted");
    });
    </script>
    <style type="text/css">
    .highlighted {
    color: red;
    font-weight: bold;
    font-size: 24px;
    }
    </style>

  15. LN says:

    Hi Hugh, great plugin. Unfortunately I’m having a problem with the category years repeating themselves. My years list looks like this:

    2012 2011 2010 2009 2008 2011 2010 2009 2008

    There are no duplicate posts. Any idea why this is or how it could be fixed? I’m using WordPress 3.4.2.

    Thanks.

  16. Dav says:

    Is there a way of limiting the amount of archives it displays ie last 6months, last 12 months? Any help would be much apreciated

  17. Ricky1990 says:

    Hi,
    I am finding a wordpress plugin which helps me to create a category list in widget but only categories which are chosen by me show. Please introduce some wp plugins to me.
    Thanks so much !

Leave a Reply

You must be logged in to post a comment.