Creating a custom archives page for your WordPress blog can make it very easy to bring all your old content together on one page. You can have one page specifically dedicated to the archives for your categories, authors, tags, posts and more. Here’s how you make this happen.
How to Create a Custom Archives Page
It starts with creating our template for your custom archives page. You will need to open a new file in a text editor, such as Notepad. Name this new file page-archive.php. Now you will need to add the following lines to your new file:
You can upload this page into your WordPress theme folder and you will have an Archives page template. You may need to rename the file if it has the .txt on the end of it. Just click “rename” and delete the .txt part of the file name. However, we still need to add some code to this file to set up the template.
Start by opening your page.php file and copy the code from this file. You can find this file in the folder for the theme you’re using.
Open the file in the edit screen and copy the code from the below the header and paste it into your page-archive.php file. It should look something like this:
This will ensure your page-archives.php template matches the rest of your site design.
Using Your Custom Archives Page Template
Now that you have created the page-archive.php file, you can use it within your WordPress Dashboard. Log in and go to Pages >> Add New. You can name this page “Archives” and you will need to select your new template from the Page Attributes menu.
When you publish this page, you will have a custom archives page for your WordPress blog. However, it won’t have any of the necessary elements to make content show up.
Adding Elements to Your Custom Archives Page
The easiest way to add the right elements to your Custom Archives Page is with the Compact Archives Plugin. This plugin allows you to create more than just the default monthly archives.
Start by installing and activating the plugin, and then add the following code to your custom archives page template (page-archives.php):
Your new Custom Archives Display will show your archived posts like this:
How to Add a List of Categories to Your Custom Archives Page
Along with displaying your archives by date, you can add a list of all your categories to your Custom Archives Page. Start by adding the following code to your page-archive.php template:
Before the code will work and category archives will show up, you will need to add the following code to your theme’s style.css file:
It will look like this after the code is inserted properly:
Other code can be used to add other custom things to your new archives page, such as a list of authors, recent posts, a list of pages, or a tag cloud. Here are the codes for all of these items:
List of Authors
List of Pages
You can use these different snippets of code to customize your archives page to your specific needs.
Why Should You Use a Custom Archives Page in WordPress
The main reason to create your custom archives page is to better organize your website. Even if you’re very new to blogging with WordPress, this is a good idea. Image, after a few years of posting how the default archives will look in the sidebar. You will have a large amount of space taken up by the many months without your custom archives page.
By creating this new page, you can better organize your archives. You will only need to display a link to the archives page and nothing else. This makes it very easy for your visitors to find your older content.