The French are a fine people, but you should be aware that this plugin has nothing to do with France or the French.

Month Grid Archive

I wanted to be able to display my monthly archives in a grid:

WordPress Month Grid Archive

With post counts for each month, but wasn’t finding a plugin for it. I did find Rob Marsh’s Compact Archives plugin which gave me a good starting place. (Thanks Rob!)

Along the way, it seemed like it would be nice to have post count totals for each year and a grand total. I think this table gives readers a nice snapshot of posting activity over the years.

It’s simple to use: put the_french_archives.php in your plugin dir, activate it, and put <?php month_grid_archive(); ?> in your template file.

You can optionally specify the month header styles. “abbr” is the default, “initial” shows only the first letter of the month, and “numeric” shows the month number. You can also customize the top row. Default is “Monthly” as shown here. If you pass in an empty string, that row will disappear.

Example: <?php month_grid_archive('abbr', ''); ?>

If there are only posts within one calendar year, the grand total won’t be shown at the bottom. (Although the row will remain.)

All Posts Archive

Inspired by the nice look of Leo Babauta’s Archives page, I also wanted to have an archives page to show all posts, like this:

WordPress All Posts Archive

For this, I found some helpful template code from Wessley Roche. I made it into a function, added the option to use a table instead of a list (now the default), added comment counts, and used “rowspan” to group multiple entries in the same day.

This one is called from your theme file with <?php all_posts_archive(); ?>.

You can optionally specify if a table should be used. Default is true. If false, it will use a list instead. (You’ll probably want to style the <ul> as list-style-type: none;.) You can also specify if comment counts should be displayed.

For example, to show in a table with no comments:

<?php all_posts_archive(true, false); ?>

CSS

There are several classes and IDs included for styling. These have changed from version 1.0 of the plugin. I initially plugged in miscellaneous classes I had laying around in my stylesheet, but decided to add more and name them specifically for the plugin in v1.1. I hope there’s enough flexibility for your needs. Take a look at the code or the generated HTML to see where classes are referenced. (Obviously, you can modify things to your liking, but my intention is to keep this part stable now so that updates should be easier.)

As an example, the screenshots above used styles like this:

.fa-table { border: 2px solid #cebb90; border-collapse: collapse;
            margin-left: auto; margin-right: auto;}
.fa-table td,th { border: 1px solid #cebb90;
                  padding: 5px; vertical-align: top; }
.fa-table th { border: 2px solid #cebb90; background: #f3e8cc; }
#fa-month-grid { width: 100%; }
.fa-hdr1, .fa-hdr3 { text-align: left; padding: 6px; }
.fa-hdr2 { font-size: .8em; }
.fa-count { font-size: .9em; }
.fa-count, .fa-total, .fa-day, .fa-cmt { text-align: right; }
#fa-all-posts { margin-top: 1.5em; margin-left: auto;
                                   margin-right: auto; }
.fa-day { font-weight: bold; }

Memory Error

I haven’t had any problems on my web host, but the “all posts” archive caused this error with my local dev instance of WordPress:

Fatal error: Allowed memory size of 33554432 bytes exhausted (tried to allocate 64 bytes) in /home/scarpent/yada/yada/www/wp-includes/meta.php on line 307

One solution I found suggested adding to the wp-config.php file:

define('WP_MEMORY_LIMIT', '64M');

Which fixed the problem for me.

Download v1.1 (66K)

Also available from the official wordpress.org plugin page.

“The French Archives” plugin has been tested with WordPress 3.0 and is licensed with the GNU General Public License, version 2 or later.

Updates

30 July 2010: v1.0: Original version.

9 August 2010: v1.1: More options for showing headers and comment counts. New class names.