How to create a Custom Archive template in WordPress

How to create a Custom Archive template in WordPressHow 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. But here we will guide you to create a custom WordPress archive page.

How to Create a Custom Archive template in WordPress -:

Create the first one-page template to add custom WordPress archive to your site. Archives it again. please save with PHP name.

<?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.

If you like my work, Please Share on Social Media! You can Follow WP knol on FacebookTwitterPinterest and YouTube 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.

Share the Knowledge!
  • 6
  •  
  •  
  •  
  •  
  •  
  •  
  •  
    6
    Shares
Amar Patel on FacebookAmar Patel on PinterestAmar Patel on TwitterAmar Patel on Wordpress
Amar Patel
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.

Leave a Comment

Follow us on Social Media