The chronological nature of blogging means that great articles can get lost in your archives. Placing a search bar and an archives widget in your sidebar can make it easier for visitors to search through older content.
You can extend this further by creating a dedicated archives page. Unfortunately, not every WordPress theme comes with an archives page template and those that do are not always structured the way you want.
Thankfully, it is very easy to create your own archives page. All you have to do is create an archives page template and then assign it to a page.
In this tutorial, I would like to show you how you can build an archives page for your WordPress website.
Check If You Already Have an Archives Template
Before we get started, I recommend checking whether your current WordPress theme already has an archives template. This will help you determine whether you need to create an archives template from scratch or simply modify an existing archives template.
The quickest way to see if your activated WordPress theme has an archives template is to create or edit a page (not a blog post!). At the right hand side of the post editor you will see the Page Attributes menu. This allows you to assign a custom page template to any WordPress page.
If your activated WordPress theme already has an archives page template, you will see an option for an archives template. The name of the archives template depends on what it has been named in template itself. Usually, it is named Archive or Archives.

Selecting the Archives Page Template
Many themes do not include an archives template, though WordPress users may be led to believe they do because they include a template named archive.php. Take the default WordPress theme Twenty Fourteen, for example.
If you modify a page, you will see that the theme does not include an archives page template. However, a quick look at the templates of of Twenty Fourteen highlights that it has a template called archive.php.

Twenty Fourteen does not have an archives template.
In WordPress, the archive.php template is an important template that is placed highly in the WordPress template hierarchy. The only template with more importance is index.php.
WordPress allows you to display older blog posts in a number of ways. Category archives can be displayed using the category.php template and tag archives can be displayed using the tag.php template. Whereas date archives use date.php and author archives use author.php. None of these archive templates are essential.
If WordPress does not find any of these archive templates in a WordPress template, it will use the archive.php template to display archives instead. And if for any reason an archive.php template is not available, WordPress will use the index.php template to display archives.

The archive.php template can be used to display a range of different archives on a WordPress website.
In contrast, the archives.php template is a page template that can be assigned to any page. It is used to create a dedicated archives page.
- Archive.php – Used to display category, date, author, tag, taxonomy, and custom post type archives
- Archives.php – A page template that is used to create a dedicated archives page
Despite these templates being used for completely different purposes, they are regularly confused by WordPress users due to their names. To avoid this confusion, many WordPress developers name the archives template something different, such as page-archives.php or archives-template.php. This is not necessary as after you define the file as a page template, WordPress will append the word template to the file in your theme file editor.
Creating a Basic WordPress Archives Template
If no archives template exists, you should create a blank file and name it something like archives.php or page-archives.php. If you had to upload that blank template to your WordPress theme directory, you will see the file listed in your template list.

What you will see in your theme editor when you upload a blank archives template file.
Like all WordPress page templates, the name of the template that appears in the Page Attributes section of the WordPress page editor is defined using the Template Name string.
In the example below, I have named my archives template Archives; however I could have named it anything. This code would be placed at the top of our PHP page template.
1 2 3 4 5 6 7 |
<?php /* Template Name: Archives */ ?> |
Once you have defined the template name in the archives template, WordPress will show that the file is a page template.

Once you have defined your archives template as a page template, WordPress will highlight it has a template in the WordPress theme editor.
The most practical way of creating an archives page template is to modify the code of your WordPress theme’s page.php template. The Creating an Archive Index tutorial in the WordPress Codex gives an example of this.
As you can see from the code below, this archives page template would display a search form, archives by month and archives by category.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
<?php /* Template Name: Archives */ get_header(); ?> <div id="container"> <div id="content" role="main"> <?php the_post(); ?> <h1 class="entry-title"><?php the_title(); ?></h1> <?php get_search_form(); ?> <h2>Archives by Month:</h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> <h2>Archives by Subject:</h2> <ul> <?php wp_list_categories(); ?> </ul> </div><!-- #content --> </div><!-- #container --> <?php get_sidebar(); ?> <?php get_footer(); ?> |
The above code is a good example of an archives page template, however the exact code of your archives page template will depend on the theme you are using. If you used the above code for an archives page template with your current theme, it is unlikely to be styled correctly as it is not based on your theme’s page.php template.
In practice, creating a custom archives page template is slightly more complicated. This is particularly true for themes that call the content of page templates from different files. For example, in Twenty Fourteen, the content part of a page is stored in a file entitled content-page.php.
If I wanted to create an archives page template for Twenty Fourteen, I could place all code in the archives template or call the content for archives from a new file I create entitled content-pagearchive.php. Neither option is better than the other. Simple use the method that you feel is best.
While placing code in specific content templates is tidier, I prefer to place all the code for the archives page template in one file. Here is an example of a simple archives page template I created for the Twenty Fourteen theme.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
<?php /* Template Name: Archives */ get_header(); ?> <div id="main-content" class="main-content"> <?php if ( is_front_page() && twentyfourteen_has_featured_posts() ) { // Include the featured content template. get_template_part( 'featured-content' ); } ?> <div id="primary" class="content-area"> <div id="content" class="site-content" role="main"> <?php // Start the Loop. while ( have_posts() ) : the_post(); ?> <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> <?php // Page thumbnail and title. twentyfourteen_post_thumbnail(); the_title( '<header class="entry-header"><h1 class="entry-title">', '</h1></header><!-- .entry-header -->' ); ?> <div class="entry-content"> <?php the_content(); ?> <?php get_search_form(); ?> <h2>Archives by Month:</h2> <ul> <?php wp_get_archives('type=monthly'); ?> </ul> <h2>Archives by Subject:</h2> <ul> <?php wp_list_categories(); ?> </ul> <?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?> </div><!-- .entry-content --> </article><!-- #post-## --> <?php // If comments are open or we have at least one comment, load up the comment template. if ( comments_open() || get_comments_number() ) { comments_template(); } endwhile; ?> </div><!-- #content --> </div><!-- #primary --> <?php get_sidebar( 'content' ); ?> </div><!-- #main-content --> <?php get_sidebar(); get_footer(); |
At first glance, the above code may seem complex; however it is actually straight forward. All I did was copy the code from page.php, replace the call to the page content template tag with the code from content-page.php, and then insert the code to display archives.
You can repeat these steps with any WordPress theme in order to create a unique archives page template for your website.
Customize Your Archives Page
There are a number of WordPress template tags that can be used in your archives page template. This includes:
- wp_list_authors() – Display a list of all authors and the number of posts for each author
- wp_list_categories() – Display a list of your blog post categories
- wp_list_pages() – Display a list of your pages
- wp_list_bookmarks() – Display URL’s listed in your blogroll
- wp_list_comments() – Display comment from a specified post or page
- wp_get_archives() – Display date based archives
- wp_tag_cloud() – Display your tags in a tag cloud
- get_search_form – Display a search form
A wide number of parameters are available for each template tag. This allows you to customize your archives page as you see fit.
For example, you can display monthly date archives using:
1 |
<?php wp_get_archives('type=monthly'); ?> |
You can display all pages in a list by using:
1 |
<?php wp_list_pages('title_li='); ?> |
You can list authors by post count by using:
1 |
<?php wp_list_authors('show_fullname=1&optioncount=1&orderby=post_count'); ?> |
A search form can also be added to your archives page by simply using the get_search_form function. This reminds visitors that they can search through your content by entering a search term.
1 |
<?php get_search_form(); ?> |
It is up to you how complex you make your archives page. You can list as little or as much information as possible. You could also place information into columns using tables.
Publishing Your Archives Page
Once you have created an archives template, you need to create your archives page. All you have to do is create a WordPress page and ensure you choose your archive template as the template.
A small description can be added to the top of your archives page. This could be placed in the archives template itself, however it makes more sense to add the description to your page as it is easier to change it later. It also makes the process of formatting text and inserting images simpler.

It only takes a minute to publish your archives page.
This is an example of an archives page I created for the Twenty Fourteen WordPress theme. You can create something similar yourself in just a few minutes.

This is an example of a simple archives page that splits the archives into two columns using a table.
Overview
An archives page presents multiple ways for visitors to find content on your website. And by helping visitors find what they are looking for, you can retain visitors on your website longer and increase pageviews considerably.
If your WordPress theme already has an archives page template, you can use archive related template tags to make your current archives page even better. Do not be too worried if your theme does not have an archives page template as the process of creating one is relatively simple.
I hope you found this tutorial useful 🙂
Kevin
- Useful Code Snippets for WordPress - 7 October, 2014
- How to Create a WordPress Archives Page - 1 September, 2014
Hi Kevin Muldoon,
Clean and perfect example to create archives page in blogs,good work keep it up,we are expecting more fantastic Articles like this,but you are writing posts monthly once in this website,its really disappointment to us…Don’t mistake me,its our humble request try to write more posts in this website.
Thanks for the kind words Shanthi. I will do my best to publish more tutorials here for you 🙂
Kevin
Thanks Kevin for a great tutorial, and welcome to the WPTD Blog!
For those of you regulars of this blog who know Kevin Muldoon and enjoy his valuable articles about WordPress, I´ve got goods news: This is the first post by Kevin on this blog, but it won´t be the last one!
And for those of you who don´t know about him yet, I´ve got good news too: You´re going to love his articles.
Thanks Luis. Great to be here 🙂
Hope you all enjoyed the tutorial.
Thanks Kevin for your great and useful article. Seriously i was looking an article related to archives creation page. I found so many articles on the internet but all they were very confusing and complicated. But now after reading your article i am pretty sure that i can create archives page for my blogs.
Thanks again Kevin and keep updating this type of useful articles.
Your welcome Bhawna. Glad you enjoyed the article 🙂
I’ve create the custom archives page and added the page to wordpress. I can also select the archives page as a template and have published the page. However, when I try to view the archives page it tries to load forever and eventually times out.
Is there something I am missing in the functions.php code or somewhere else?
ok, so I was confused, and was able to solve the previous issue. I have a basic template working, but it does not load my sidebar alongside the content. It pushed it down the the very bottom on the screen.
Is there a problem with the divs? http://thenerdynurse.com/archives
It looks like you were able to solve it already.
I used a plugin – I would have prefered to code in manually. However, your article was the one i found which clarified the difference between archive.php and archives.php – thanks so much for that!
Thanks Kevin for this article.
hi, yes this is really great. An Archives page is really helpful web explorers..
Hello Kevin,
Great to have your informative postings!
I have a site-map.php template but it’s very plain. Would love to ‘spruce’ it up and put the info into sections that not only look good, but are helpful, of course, to my visitors. I am wondering if it wouldn’t be easier to create a NEW site-map(archives template) and style it the way I want? Or would it be easier to copy the archives template into my child theme and modify it?
Thanks again for the useful information – looking forward to more from you!
~ freida
Best poster about creating file description. Explained and easy to understand as well.
All double dutch to me as a newbie, so all the more reason to create an archives template. tku so mch kevin. great work it seems.
mary (Ireland)
Hi Kevin,
Thanks for the great article, it was very helpful!
Using your code, I created three separate archives — one for category, person, and month.
You saved me a ton of time. Thanks again!
🙂 Jennie (aka tanster)
Thank you for this tutorial , I’m an avid reader and learner of WordPress and blogging , and this article explains it very nicely.
Thanks kevin for this article.
Thanks for this, it’s really depressing staring at archive(s).php for hours and not understand what’s going on or even if you’re in the right place – the art is knowing what to Google, in the end it was “archive.php tutorial” that brought me here – really simple!
You made my day, the sun’s shinning (for me) again.
Hi, This article contains an interesting diagram – The archive.php template can be used to display a range of different archives on a WordPress website. – which seems to contain alot of useful information, but unfortunately it’s totally illegible, would it be possible to receive an enlarged version
Thanks
David
Hi, David.
You have an interesting and interactive version of that diagram available here: WPHierarchy
Thanks Luis, that’s great!
Hi Luis Nice guide will Try this on my blog ..Thanks for the Tutorial…
How do you actually upload the .php page template you create? I can edit an existing file for my theme, but I can’t see how to upload a new one. Thanks!
Hi, Angela.
If you need to upload a new PHP file you´ll need a ftp connection to your server.
Thanks, I have been looking for how to create archives page for so long
Thanks Man Much Help .
The archives page process is very.God I was searching for the same since hours.
Another very good WordPress plugin that can handle this function is “WP Sitemap Page” its a free plugin that displays your site archives in any page or post with a lot of options that will help you to customize the WordPress archives page.
Thats i want it sir, before i’m very confuse to know what my client want from looking another site
what is the purpose of archive? will it help in minimizing the resources?
Hello Kevin,
You elaborately explain all the things in a very well organized manner.Really very helpful resource. Thanks a lot for your wonderful work.
hey should i add archive page in sitemap. ass post or page are same as home page so it will create duplication right?
Hi dude, i have also find out one good example
Get Category Which Has Posts – WordPress Example