Snazzy-Archives, Filtered

Note that this post is a dupli­cate of the Snazzy-Archives, Filtered project page, here at Netninja, and copied into the blog. It has been inserted here to make it part of the blog time­line, RSS, and what­not so that it gets noticed. Comments are dis­abled on this post but enabled on the project page, so go there to com­ment.

Earlier this year, I got seri­ous about the post archives here at Netninja.com. I added meta­data for sev­eral years worth of posts. Partly this was me being anal-retentive and partly this was to facil­i­tate bet­ter search­ing, brows­ing, and match­ing related posts. This was a suc­cess­ful project, but exposed what I believe to be a defi­ciency in WordPress: Although search­ing and serendip­i­tously falling into related posts is easy, there is no easy way to browse sev­eral years worth of posts.

I ini­tially used Clean Archives Reloaded for brows­ing old posts. As I under­stand it, Clean Archives Reloaded was writ­ten by a Portland local. This worked fairly well, but didn’t play well with the wp-typography plu­gin I use. Wp-typography takes text and replaces reg­u­lar quotes with smart quotes, pro­motes com­bi­na­tions of dashes to fancy em– and en-dashes and what­not. With the size of my archives, the web server croaked due to mem­ory usage. I patched wp-typography to ignore this page, but every time I upgraded the plu­gin, my changes would get over­writ­ten and I would inevitably for­got to re-edit the rel­e­vant files, leav­ing my archives bro­ken.

I finally gave up and started explor­ing other options. Snazzy Archives looked rather nifty. I tried it out and it... mostly worked. Due to the size of my archives, it took for­ever to gen­er­ate the page. The browser chugged along try­ing to dis­play it. I would often get Error 500 from my web host due to the server load of gen­er­at­ing the page.

snazzy-archives

This plu­gin uses a short­code to invoke: [ snazzy-archive ] (with­out the spaces — I did not want to invoke the archive here). You sim­ply cre­ate a page, add that short­code to the page, and it gets replaced by the fancy archive.

What I ended up doing was hack­ing the plu­gin so that the short­code takes an optional “fil­teryear” argu­ment. If miss­ing, all years are dis­played. If present, the results are fil­tered to just that year. In this way, I can cre­ate sep­a­rate pages for 2001, 2002, 2003, and so on. This makes the ren­der­ing, dis­play, and pre­sen­ta­tion much more man­age­able. It can then be invoked with: [ snazzy-archive filteryear="2008" ]

The patch is down below, for those that care. I will be sub­mit­ting it to the author soon. My next step is to fig­ure out the CSS enough so that the miss­ing right-hand mar­gin on the archive pages can return.

For the exact patch and to leave com­ments, please go to the project page at http://netninja.com/projects/snazzy-archives-filtered/.
Posted in: Code Projects