I’ve not been very happy with my archives page for a long time; I hated the default layout and I wanted it to look more orderly, with headers for each month listing the corresponding entries underneath. Groaning, I resorted to having to hack one out myself sometime, but of course, I’ve been too lazy to do so.
Imagine my surprise when I came across Cine’s Monthly Archives plugin, which does exactly what I’ve wanted an archive page to do. I love the links to each year, the month headers with lists of individual entries underneath, and the way the script is so easy to tweak. I’ve already had to add a bit of code of my own so that my drafts and private entries weren’t displayed in the list; I found
$query = mysql_query("SELECT *, year(post_date) as year, month(post_date) as month FROM $tableposts WHERE year(post_date)='$year' AND month(post_date)='$date[month]' ORDER BY id desc") or die(mysql_error());
and replaced it with this:
$query = mysql_query("SELECT *, year(post_date) as year, month(post_date) as month, post_status FROM $tableposts WHERE year(post_date)=’$year’ AND month(post_date)=’$date[month]’ AND post_status = ‘publish’ ORDER BY id desc”) or die(mysql_error());
and voila! No more drafts or other pages appearing in my archives!
I still need to add dates to the individual links so that instead of the link just saying ‘Post title’ it will say ‘20th – Post title’. I’ll look at it in a little bit, but I don’t think it will be very difficult.