Archives page is good for many reasons. One is because it helps you keep the clutter from your sidebar such as old month links. Second, it helps your users browse the site efficiently. Often users ask questions that you have already answered in the past, so archives page is their best option to search for the answer. Not saying that they can’t use the search bar, but sometimes the search feature fall short. Therefore it is good to make a very detailed archives page.
First Step to creating an archives page is open a blank document, and name it blogarchives.php.
Second you need to establish that blogarchives.php has its own template, so WordPress knows that it is different from any other page.
<?php /* Template Name: Archives Page */ ?>
Once you have done that, you can add all the design elements to your archives page. You can sort the archives page by month, tags, categories, or you can have all of them to give your user more options.
Here are some of the codes you can use in your archives page:
You can show Archives by month using this code. Wrap it around with the styling to make it perfect with your design.
<?php wp_get_archives('type=monthly'); ?>
Another good element that can be added to the archives page is the listings by category. It eases the process of searching for your user.
<?php wp_list_cats(); ?>
Tags are also helpful to the user when browsing through the archives. Remember the value of smallest and largest are the font sizes that you are going to show in the tag cloud, so your user can see which tag is most used. This code below will show the tags in a list format. The number 30 shows the number of tags will be displayed. Refer to WordPress Codex if you have questions regarding tags.
<?php wp_tag_cloud('smallest=8&largest=12&unit=pt&number=30&format=list&order=RAND'); ?>
Adding recent articles to the archives page helps increasing page views and get your new articles to the audience. Change the number 17 to the a number of your choice. It tells the database how many posts to show in the output.
<?php get_archives('postbypost', '17', 'custom', '<li>', '</li>'); ?>
Once you have added the codes of your choice, save the blogarchives.php and upload it in your templates folder where other files are such as single.php and page.php
Now go to your WordPress Admin Panel, Add a New Page. On the right hand side, you will see an option of Templates. Change the template to “Archives Page”.
Leave the Page Content Blank, and just publish the page. You should now see an archives page. Link it from your navigation, and now you have an archives page in WordPress.