Archive Templates As Summaries
Alan Levine aka CogDog barked this April 28th, 2005 11:45 am
Ok, chipping away more at the WP templates. One of my blog software critcisms is the notion that an “archive” listing is just a bunch of the posts in a category or date range all glued together (see “All Your Archives Are Wrong”).
To be honest, I should poke more through the WordPress docs and better understand the template system, but I am more prone to hack away at the templates until they do what I like.
So I just monkeyed a bit to get WordPress playing my way. First for the Date archives, edit the archive archive.php template, changing the portion that reads:
<?php while (have_posts()) : the_post(); ?>
<div class="post">
<h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>"
rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?></a></h3>
<small><?php the_time('l, F jS, Y') ?></small>
<div class="entry">
<?php the_excerpt() ?>
</div>
<p class="postmetadata">Posted in <?php the_category(', ') ?>
<strong>|</strong> <?php edit_post_link('Edit','','<strong>|</strong>'); ?>
<?php comments_popup_link('No Comments »', '1 Comment »',
'% Comments »'); ?></p>
<!--
<?php trackback_rdf(); ?>
-->
</div>
<?php endwhile; ?>
to read:
<div class="post">
<ul class="arch_list">
<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>" rel="bookmark"
title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?></a> (
<small><?php the_time('l, F jS, Y') ?></small>)<br>
<?php the_excerpt_rss() ?>...
<br><small>Posted in <?php the_category(', ') ?>
<strong>|</strong> <?php edit_post_link('Edit','','<strong>|</strong>'); ?>
<?php comments_popup_link('No Comments »', '1 Comment »',
'% Comments »'); ?></small></li>
<!--
<?php trackback_rdf(); ?>
-->
<?php endwhile; ?>
</ul>
</div>
Note that I am using the_excerpt_rss() to get a non HTML shorter version for the text of the post excerpt as a brief summary. I’ve flattened some of the display, and put it in an unordered list (my own stylesheet addition of a .arch_list li class listing is just something with margin-bottom:1em to space items on the output)
This creates to me more of an archive as an index, rather than an archive of glued together posts. For category archives, you can use the same file saved as category.php
- Measuring Up For Success!
- Video Camera for Speech and Debate
- Supplies Needed for New Housing & Interior Design Class

