If you impress your first time reader then the chances are very high that he or she may look for your old articles, Unfortunately most of the bloggers don’t make this process simple enough for them, thats why some pro bloggers use an Archive page. An archive page is like a sitemap for your readers to navigate through your buried contents, A reader can easily navigate to your old articles based on a month, year, category and even by tags.

In this simple WordPress tutorial I am going to show you how make your custom archive page within few minutes. Note to Genesis Users – Genesis users integrate the archive page template to the core theme, So just create a new page and on right sidebar select the page template as “Archive” and publish it. Even though its integrated you can still try this tutorial to create your own version of archive page. I have split the process into two parts

  1. Creating an archive page template
  2. Creating an archive page

Don’t get confused by the terms, The first part is to create a generic page template for archive which can be assigned to any page to create an archive page. So lets get started.

Creating an archive page template

Create an empty file called page-archive.php and place it in your themes root folder. Now we need to define the code which tells WordPress to treat this file as a page template. Add the following code to the file

<?php
/*
Template Name: Archives
*/

Next you need to call blocks like header and bring the entire page inside your content block. To do so add the following code to your file.

get_header(); ?>

<section id="primary" class="content-area">
<div id="content" class="site-content" role="main">

Note that css id and class may differ for various theme. The above one is for WordPress default themes like Twenty fourteen and Twenty thirteen. To find it edit your themes archive.php file. Now I am going to define part which is actually displayed in the page.

<?php the_post(); ?>
<h2>Recent Articles</h2>
<ol><?php wp_get_archives('type=postbypost&limit=10'); ?></ol>
<h2>Archives by Month:</h2>
<ul><?php wp_get_archives('type=monthly'); ?></ul>
<h2>Archives by Category:</h2>
<ul><?php wp_list_categories(); ?></ul>

What does these do ? In third line above we are displaying 10 most recent articles, In line 5 we are displaying Archives based on monthly and at the line 7 archive based on category. This is a very simple archive template. You can include plenty of other links like

This is how our final code looks like

Now lets create an archive page.

Creating an archive page

Go to your WordPress dashboard and Pages >> Add New. Name your archive page anything and in right side you can find option to select page template. Choose “Archives” template and hit publish.

archive

Create Archive Page

Thats it you have successfully created a custom archive page template for your WordPress theme. If you have any feedbacks please let me know through comments below.

Comments

  1. says

    Well i was searching for the content to create custom archive page from a long but i doesn’t get the exact refernce for this. Thanks to you for such nice attempt and providing in such sytematic and easy manner to sum up the content.

  2. says

    Hi Vivek,
    Nice tutorial on creating a good looking archive page, and when it comes to doing with Genesis framework i remember archive page of Darren Rowse’s Problogger a good looking page which forces any first time user to look for more and more posts.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>