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 v1.0.6 displays the monthly archive of posts in three 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
or in a numeric form:
2006: 01 02 03 04 05 06 07 08 09 10 11 12
2005: 01 02 03 04 05 06 07 08 09 10 11 12
2004: 01 02 03 04 05 06 07 08 09 10 11 12
- Upload the whole plugin folder (Compact_Archive) to your /wp-content/plugins/ directory.
- Go to your Admin|Plugins page and activate Compact Archive.
<?php compact_archive(); ?>at the place in your template where you want it to appear, e.g., in your sidebar:
<ul> <?php compact_archive(); ?> </ul>
- 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='<li>', $after='</li>');
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.
If $style == ‘numeric’ the display will use numeric values for the months.
$before and $after wrap each line of output. The default values make each line of the archive into a list item.
<?php compact_archive(); ?>
The year link at the start of each line is wrapped in
<strong></strong> and months with no posts are wrapped in
<span class="emptymonth"></span> 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.
- Compact Archive v1.0.6 adds the numeric month display.
- Compact Archive v1.0.5 fixes a problem showing localised dates with accented characters.
- Compact Archive v1.0.4 makes use of the Plugin Output Cache if it is available.
- Compact Archive v1.0.3 fixes a small problem with undated posts.
- Compact Archive v1.0.1 still works with previous versions of WordPress but takes advantage of new features of WordPress 2.1.
- Compact Archive v1.0.0 is the original plugin.
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.
If you try this plugin leave a comment here to let me know how you get on.