Here is how to create a custom archive page in WordPress just like the one you see on our blog.
1. Go to the current theme folder of your WordPress installation (wp-content/themes/*current theme*) and make sure you don’t already have archives.php in the folder
2. Create a new file called archives.php (or whatever file name you want to give)
3. Copy and paste the following code into the new file and upload it to your current theme folder (wp-content/themes/*current theme*)
<?php /* Template Name: Archives Page */ ?> <?php get_header(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="post-page" id="post-<?php the_ID(); ?>"> <h1><?php the_title(); ?></h1> <?php the_content('<p class="serif">Read the rest of this page »</p>'); ?> <h2>Archives by Title:</h2> <ul> <?php wp_get_archives('type=alpha');?> </ul> <h2>Archives by Month:</h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> <h2>Archives by Subject:</h2> <ul> <?php wp_list_categories('title_li='); ?> </ul> <?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?> </div> <?php endwhile; endif; ?> <?php get_footer(); ?>
Note: You will probably need to modify this code a bit to match the code structure of your current theme. For example, you might need to have get_sidebar() or you might have extra markup.
4. Login to your WordPress Administrator Panel and create a new page (and name it whatever you like. Ours is called “Archive”)
5. On the right side of the create/edit page, you will see Attributes section where you can specify settings for Parent, Template and Order. Choose “Archives Page” for Template and publish/save your changes.
You now have an Archive page for your WordPress blog that is similar to our Archive page.