Recent Comments: WordPress Plugin Beauty?

Compact Archive: WordPress Plugin

Print Version October 29th, 2006

Description

My blog has posts going back over 11 years and the archive of posts by month in my sidebar was getting very much out of hand. In the search for a more compact way of displaying the monthly archive a plugin was born.

Compact Archive displays the monthly archive of posts in two compact forms. It can be shown as a block suitable for the body of an archives page, e.g.:

2006: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2005: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
2004: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec

or in an even more compact form to fit nicely in a sidebar:

2006: J F M A M J J A S O N D
2005: J F M A M J J A S O N D
2004: J F M A M J J A S O N D

Instructions

  1. Upload the whole plugin folder (Compact_Archive) to your /wp-content/plugins/ directory.
  2. Go to your Admin|Plugins page and activate Compact Archive.
  3. Put<!--?php compact_archive(); ?--> at the place in your template where you want it to appear, e.g., in your sidebar:
     
  4. You might want to adjust your style sheet to make the months with no posts fade into the background.

The template tag, compact_archive, has some parameters:

compact_archive($style='initial', $before='

  • ', $after='

 

‘);

If $style == ‘initial’ (the default) the display will fit into a sidebar.

If $style == ‘block’ the display will be wide enough to fill the main column of a page.

$before and $after wrap each line of output. The default values make each line of the archive into a list item.

 

The year link at the start of each line is wrapped in and months with no posts are wrapped in so you can differentiate them visually using your style sheet.

Compact Archive honours whatever kind of permalink WordPress is using and the month names and abbreviations are chosen in accordance with the language locale (WPLANG) set in wp-config.php.

Acknowledgements

The idea for this plugin comes from the SmartArchives plugin by Justin Blanton ( http://justinblanton.com/projects/smartarchives/). It is a rewrite of the ‘block’ half of his tag. I have added a very compact version that fits nicely in a sidebar.

Feedback

If you try this plugin leave a comment here to let me know how you get on.

Entry Filed under: Programming,WP Plugins

10 Comments

  • 1. Brian Jarrett  |  December 20th, 2006 at 2:35 am

    Great plug-in! It really shrunk down the size of my archives listing. Thanks for writing it and releasing it.

  • 2. David  |  January 10th, 2007 at 4:14 am

    Thanks for this nifty plugin! It works great and looks good.

  • 3. Rob  |  January 10th, 2007 at 7:53 am

    David: Thanks!

  • 4. Rob  |  January 14th, 2007 at 5:58 pm

    Compact Archives now has a page of its own.

    Comments are now closed for this post.


Calendar

October 2006
M T W T F S S
« Sep   Nov »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  

Related Reading