Caveat
Maintenance and development of this plugin has been taken over by WpBeginner. Compact Archives can be downloaded from the WordPress plugin repository.ย
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 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
Instructions
- Upload the whole plugin folder (Compact_Archive) to your /wp-content/plugins/ directory.
- Go to your Admin|Plugins page and activate Compact Archive.
- Put
<!--?php compact_archive(); ?-->
at the place in your template where you want it to appear, e.g., in your sidebar: - 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.
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.
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.
Version
- 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.
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.
Excellent idea. I’ve never really had much use for navigating by date, aside from showing visitors the blog has a long history, but this is a great and compact way to do both.
Rirath: thank you!
Great plugin! Thanx a lot for coding it!
It took me a little while to implement this plug-in between WP 2.0 whatever and using K2, but I was able to add it, and I love it!
Previously I was using a plug-in that created a drop-down menu out of archives, but upon upgrading WP, that plug-in no longer functioned.
Since I’ve got over 3 years of archives, I’m glad to have a compact way to list them that doesn’t scroll down my page for miles. ๐
Version 1.0.1 updates the plugin to take advantage of new features in WordPress 2.1.
How do you get the list of blog items below the
“2006: Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec” line as you have it on your archieve page?
Do I need to change something in the plugin to make that happen?
Many thanks for the reply! Cheers, Michiel
Michiel Maandag: That is using the archive code provided in the Blix theme I use (slightly modifed for speed).
Awesome plugin. Especially nice considering I’ve got stuff going back to 2001.
I’ve got it working (thank you SO much for making this!) but I have one extra line of archives, with nothing in it, below my last year of archives, listed as “0” with no entries for any of the months. How do I get rid of that?
turtlegirl76: That’s very odd! I’ll have a look and see if I can discover what on earth could be causing it.
turtlegirl76: Let me know whether v1.0.3 fixes the problem. I think you may have a post without a proper date for some reason… anyway this should filter it out.
Thank you so much! That did fix it!
I blame blogger. It must have been something from when I imported my old posts.
I have just updated Compact Archive to use my new Plugin Output Cache plugin. If the cache is available it makes the archive much more efficient.
Wonderful, your plugin makes the archives nice and clean.
One thing though: non-standard characters in month names don’t go well (and break validation).
I fixed this by surrounding the calls with
utf8_encode
but that might not work for everybody.Maybe you could just hint to this workaround if those funny characters show up.
Julia: Thanks for your comments. I am dealing with a number of language-related issues at present so this just adds one more! I’m certainly learning…
Julia: Version 1.0.5 contains the utf8 fix as standard so you can remove the extra code in your template. Thanks!
Love this plug-in, my blog goes back to 2002 and this really helped tidy up my sidebar. Thanks again!
I have modified this plugin a bit to suit my needs, but since I havent “officially” moved to WordPress yet – I’m sending you my version (1.1.0) via e-mail.
Moved and using it ๐
The version I’ve sent has an obvious error, I hope you got it by now. It didnt pass the parameters from one function to another.
Hi. How do I get this plugin to work inside a wordpress page? thanks.
John: You would need to create a page template with a call to the plugin embedded in it and then create a page based on that template. My own archives page is based on the following template:
Hi there… I’m also facing problem getting it to work on a WP page. Do I need to insert the codes shown just above to the existing ‘page.php’ in my template folder?
Can you kindly guide me through the steps cos I am a total noob in codings. LOL!
Thanks in advance!
Daryl
You need to create a file in your template directory alongside ‘page.php’ called ‘archives.php’ or something. Copy the code I gave above to fill that file. Make sure there are no extra spaces or anything above or below the code.
Then inside the WP admin use Write Page to make a more or less blank page with whatever title you want. Make sure you base the page on your new template.
I hope that works for you.
Hi. Rob.
I installed your compact archive to my new-born blog.
It looks quite good on minial theme.
I content with this appearance but I want to make this abbr(ex Jan, Feb) to arabic number(1,2,3..). If I never edit the wp-config.php(WPLANG status), ‘initial’ style look similar that I hope. But it is not bad when the digit go over 10. It looks like following:
1 2 3 4 5 6 7 8 9 1 1 1
Can I fix this problem?
Gazrang: Try editing the ‘block’ output code to replace
%b
with%m
, i.e.,$month_abbrev = strftime("%m", $dummydate);
Wow. Thank you for your reply. ๐
That worked seemlessly..
Using compact archive, I made archives page on sidebar.
On click the archive menu, page shows ‘blocks’ of whole year one line. But it never shows the whole post-title-list like your archive.
I made Archive page using your template above, and modified to fit my theme.
Any idea how we would make this a widget? I’d like to use this on my wordpressMU install, but dont want to have to have users add it to the theme code.
vincent: I believe making it a widget would pose no insuperable difficulties — it’s just something I’ve only glanced at a few time rather than thinking seriously about. I’ll have another look…
Rob,
I love how compact it is, but it would also like to see it as a widget.
In any case – thanks for sharing!
SC
Scudfish: Maybe I’ll take this as an opportunity to learn about widgets.
Thanks for releasing this very nice plugin. I just added it to my blog, and it looks great.
Nice job!
thanks so much! lost my old archives with the 2.1 upgrade but this is working beautifully and was so easy to set up!
This is a great way to display a monthly archive. I love it!
Great plugin, I use it on my blog.
Thanks
I Cannt Find To Do Archive In A New Page
I Want It To Open It In A New Page. The Archive Is In To The Header. How Can I Do This
Your plugin slowed down the loading of any page on my blog from a load time in seconds of 0.72 seconds without the plugin TO 4.44 seconds with the plugin activated! ๐
I’m using WP2.0 by the way, is that the reason or is it a bug you might need to fix?
I used this code:
Slowload: I hope you mean it slowed down the pages on which it appears… That doesn’t surprise me since the plugin does a lot of work putting together the archive of all your posts. You can make it a lot more efficiient by install my Plugin Output Cache which will keep a copy of the archive and only regenerate it when necessary.
If you mean that the plugin even slows down pages on which it doesn’t appear … that would be a serious problem.
Hi Rob, thanks a million for the tip! That fixed any slowdown that was occurring, it just wasn’t being cached heh. Thanks again for the great plugins, I’m going to try out more of yours now.
cool stuff!! just a question though.. is it possible to swap the months Jan Feb Mar into numbers in mm format as in.. 01 02 030 4.. 12 ??
Any help or advise will b greatly appreciated!!
=)
Dominic: Check out version 1.0.6!
I was wondering if this will work as a Text Widget? I tried adding
<?php compact_archive($style='initial'); ?>
to my theme, but nothing is being output…
— Marty
Marty: I’m afraid I haven’t mastered widgets yet … but what you need to try is
<?php compact_archive('initial'); ?>
Let me know if this helps.
Thanks – I couldn’t get it to work as a widget, but I was able to put it directly into the sidebar and get it to work.
Marty: Glad to hear.
i’ve been trying to get the formatting right, but i’m having no luck.
i have the following in my stylesheet to change the text color to match the background for all of the “emptymonths” but it doesn’t appear to be working.
the only complication i have is i am using a modified RoundFlow theme which uses php to set color options in the css from the WordPress admin.
Any help to work round this greatly appreciated
james: I don’t know the theme you mention but the code looks OK to me. Could it be a caching issue?
Thank you very much. I love this style of list and your plugin makes it a cinch.
Thank you, it works, but I have the following problem: in the site I’m developing, months are displayed in small letter:
# 2007: ene feb mar abr may jun jul ago sep oct nov dic
I would like to display them in big letter
I’ll really appreciate your help!
I uploaded and set this up on a page today, and received a rather nasty looking error…any thoughts? I created an archives.php file based on the info you had above, then created a new page with the following code:
Here’s the error, which is also displayed at the top of the page…if you want to take a peek on my site. Thanks.
Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in /home/snarlyn6/public_html/wp-content/themes/petlover-10/archives.php on line 7
Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in /home/snarlyn6/public_html/wp-content/themes/petlover-10/archives.php on line 10
{\rtf1\mac\ansicpg10000\cocoartf824\cocoasubrtf420 {\fonttbl\f0\fswiss\fcharset77 Helvetica;} {\colortbl;\red255\green255\blue255;} \margl1440\margr1440\vieww9000\viewh8400\viewkind0 \pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\ql\qnatural\pardirnatural \f0\fs24 \cf0 \ \