How to Create Custom WordPress Archive Page

Do you want to create a custom archive page for your WordPress site? WordPress archive page is a great solution to display your old post in a single page. In it, you can list monthly archives, category archives, tag archives and author archives etc. Today in this article we will tell you how to create an archive page in WordPress.

However, WordPress comes with a default archives option widget that you can place in the sidebar of your site. But here we will guide how to create a custom WordPress archive page.

So, let's get started...

How to Create a Custom WordPress Archive template


To add custom WordPress archive on your site first create a page template save it with Archives.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(); ?>

After pasting the code, just upload it in your current theme folder (wp-content >> themes >> your current theme).

Now, your Custom WordPress Archive Page includes following things,

  • Search Form

  • Archives By Month

  • Archives By Category


How to Create Archive Page in WordPress


Simply add a new page by clicking on Page >> Add New then under the Page Attributes section, select the Archives from template drop-down menu.

how to create archive page in wordpress

You do not need to add anything to the blank page. Now publish your page or click on the preview button to check it.

Congratulation, You have successfully created WordPress archive page in your site. You can comment for any questions related to this article.

Also check out

Like how to create Archive page in WordPress? Don't forget to share it!

Comments

Popular posts from this blog

Fix Submitted URL marked ‘noindex’ in Google Search Console Tool 2018

Keep these 12 things in mind before applying to Google AdSense

What is Google Adsense and How much you can make money