A Different Monthly Archive Script

This WordPress plugin displays a “different” monthly archive in the format of a table, instead of the standard unordered-list that many sites use. To see it in action, look right a little. It’s the thing I use on my site.

Download

nicearchive.php is available for download now. To install it, pop it inside the ‘plugins’ subdirectory of wp-content (and rename it to nicearchive.php). To activate it, go to “Plugins” in the admin area and click ‘activate’. It really is that simple.

Usage

To use, add in a php call to <?php get_niceArchive(); ?> somewhere in your template (probably the sidebar). There are, however, some optional parameters:

  1. $order default: DESC. Used in the ordering of the table. Use “DESC” to order from highest year to lowest (i.e from today backwards), otherwise “ASC” (i.e from the past forward until today). Mine is DESC, so it starts at 2005 and goes backwards to 2oo4, 2003, etc.
  2. $tableClass default: datearc. Used for the CSS class for the whole table.
  3. $tableClassAlt default: datearcAlt. CSS class used for one part of the alternating backgrounds (1st and 3rd column).
  4. $tableClassAlt2 default: datearcAlt2. CSS class used for second part of the alternating backgrounds (2nd and 4th column).

Sample CSS

The CSS below is taken from this site’s stylesheet:


.datearcAlt2 , .datearcAlt {
    border-bottom:  1px solid #DCDCDC;
        font-size: 0.86em;
        padding: 2px;
    width: 25%;
        text-transform: lowercase;
}
.datearcAlt2 {
    background: #E7E7E7;
}
.datearcAlt {
    background: #F7F7F7;
}
.datearc {
    border: 0px none;
    padding: 0;
    margin-left: auto;
    margin-right: auto;
    width: 165px;
    }

This creates a basic alternating column colour table. You can write your own CSS for the “th” element, which is used when displaying the years.

About

I used to use this on my old MovableType weblog but converted it when I changed over to WordPress. I don’t, however, own the script - it was originally featured on RoyalTS. As for a license, I’m not really that sure.

Version History

Version 1.4 (4th March 2006): The script is now multilingual :) . It displays the 3 letter months based upon your Wordpress locale.
Version 1.3 (5th January 2006): The script now gives a link to the ‘proper’ permalink page (using your defined permalink structure) for each month instead of to the main wordpress index.php. I have also been told that this script is compatible with Wordpress 2.0.
Version 1.2.2 (21 September 2005): Added small bugfix to add &nbsp; to all empty cells instead of a blank space, and also added feature to only pad out incomplete years to the nearest multiple of 4, so a year with only one month will not show 12 cells.
Version 1.2.1 (17 May 2005): Added a hard-return after the “<?php” at the start of the code to fix some ‘headers already sent’ errors being displayed after script activation.
Version 1.2 (14 May 2005): Added some comments as to how the array $monthlyarchive is populated and also fixed a small bug that did not create extra table cells if there was a row that was not currently full.
Version 1.1 (15 Apr 2005): Added the ability to choose the sort order of the table.
Version 1.0 (14 Apr 2005): First version. Added (simple) parameters for setting CSS classes used in the table.

WordPress database error: [Can't open file: 'wp_comments.MYI' (errno: 144)]
SELECT * FROM wp_comments WHERE comment_post_ID = '813' AND comment_approved = '1' ORDER BY comment_date

92 comments »

RSS feed for comments on this post.

leave a comment