How to create a Custom Archive Template in WordPress

How to create a Custom Archive template in WordPress
Do you want to create a custom archive page for your WordPress site? The WordPress archive page is a good solution to display all your old and new posts on a single page. In it, you can add monthly archives, category archives, tag archives and author archives etc. In this article today, we’ll show you how to create a Custom Archive Page in WordPress. However, WordPress comes with a default archives widget that you can place in the sidebar of your site. In this post I will explain how to create custom archive page in WordPress.

How to Create a Custom Archive template in WordPress -:

Create the first one-page template to add custom WordPress archive to your site. save it as Archive.php

<?php
/*
Template Name: Archives
*/
get_header(); ?>

<div id="container">
	<div id="content" role="main">

		<?php the_post(); ?>
		<h1><?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(); ?>

Then upload it into your current theme folder (wp-content >> themes >> your current theme).Now, this Custom WordPress Archive Page will add the following things to your site.

Search Form
Archives By Month
Archives By Category

How to create a WordPress Custom Archive Page-:

After you complete the above process, simply click on page >> Add new option and select Archives from the template drop-down menu in the Page Attributes section. You don’t need to add anything to this empty page. Now click the preview button to publish your page or check it. Congratulations, you have successfully created the WordPress archive page in your site. You can comment for any questions related to this article.

Conclusion-: Custom Archives page is one of the best way to show Search form, Show old content, Archive by month or category. I allow you to have a dedicated page.

If you like my work, Please Share on Social Media! You can Follow WP knol on FacebookTwitterPinterest and Quora for latest updates. You may Subscribe to WP Knol Newsletter to get latest updates via Email. You May also Continue Reading my Recent Posts Which Might Interest You.

About Amar Patel 263 Articles
Hi, I am Amar Patel from India. Founder, Author and Administrator of wpknol.com. I am a Simple Average Man who Loves life and Love living life.Professionally I am a Mechanical Engineer. Apart from my Job, I Love to write the things around WordPress WordPress CMS.