Taking Care of WordPress

Saturday 6 August 2005 @ 18:57 // Filed under Linkage, WordPress

A blog is like a tree. It needs to be fed (water/posts), and it needs to be taken care of. Have you talked to your tree lately?

How to Make a WordPress Archives Page

Tuesday 28 June 2005 @ 23:45 // Filed under Hacks, Usability, Web Dev, WordPress

By default, WordPress doesn’t seem to have an archives page. It just stacks up all your months of writing in the sidebar. This strikes me as an inelegant solution (interface clutter, anyone?) It also strikes me as a solution that does not scale well. I haven’t yet come across a WP site that’s been going for, say, five years (in fact I don’t think its been around anywhere near that long), but just imagine.

It’s actually remarkably easy to make your own archives page with the power of WordPress templates (AKA themes.) Being a little familiar with these helps, but is not necessary knowledge. You’ll also need to grab the Clean Archives plugin.

Begin by making the template for your archives page. Create a file named (say) archives.php in /wp-content/themes/currentThemeName/.

<?php
require('./wp-blog-header.php');
/*
Template Name: Archives Template
Description: A template for archives pages.

Note: requires Clean Archives plug-in
http://www.sporadicnonsense.com/2005/04/28/clean-archives-plug-in/
*/
?>

<?php get_header(); ?>

<h1>Archives</h1>

<!-- You may wish to add a search box here -->

<?php echo srg_clean_archives(); ?>

<?php get_footer(); ?>

The second and final step is to create the “page” in WordPress. Go into your WP admin area then Write > Write Page. Give it a title (eg. Archives.) Down in Page Options you will see Page Template. Select Archives Template, and click Create New Page.

Important! If you are using permalinks, make sure your .htaccess file is writable (eg. chmod 777 it) before doing the above step!

And that’s it. You should have a nice page like so. Remember to make sure it’s valid XHTML.

Acknowledgments: this post drew heavily on Secrets of WP Theming Part 1.