WordPress is a fabulous platform that is admired by a whopping number of web users.
It is one of the most popular web development platforms that offer amazing blogging experience.
This open source CMS is lauded for its blissful offerings, including easy customization, intuitive dashboard, a slew of resourceful plugins and captivating themes, to name a few.
This powerful blogging platform provides numerous features that add to its credibility, and one of its useful features is its custom archives page.
With a custom archives page, you can display all your old posts in one page or you can organize your blogs in different archives categories.
It is quite helpful for bloggers to showcase their posts in a well-organized and legible fashion, so that readers can proficiently go through and choose a desired post to read.
In WordPress, every page has its template and so the archive page.
Since, the default archive template is not intuitive, most of the WP users don’t pay much attention to its look and feel.
However, one must endeavor for a captivating and uncluttered archive page to augment easy accessibility to his variety of posts.
Fortunately, WordPress allows one to tailor his archive page by creating a custom page template for archives.
To help with the development process, I have unleashed the entire process in this post.
Let’s begin with this step-by-step guide to create a custom archive page template in WordPress
1. Create a new file for the page template
Create a new file in any text editor, like Notepad++, gedit, etc., and save it as
Now, open this file and paste the comment as mentioned below to in the file. This will help WP recognize the file as a page template.
<?php /* Template Name: Archives Page Template */
2. Matching the style of the page template with that of the website
Now, in the folder where you have your WP website, upload the
archive-page.php file that you have just created in the previous step.
By doing so, you will get a custom page template for archives.
Further, ensure that the style of your website and the custom template match each other.
This can be efficiently done by copying and pasting the content of the
page.php file (saved in your theme folder) into the just created
3. Creating a custom archives page in WP site
Once you are done with creating a custom page template, a new page has to be created in the website for a custom archives page.
For this, navigate to your admin dashboard and click on the Add New option available under the Pages tab in the navigation menu.
Now, give a desirable name to the page, here I have used “Archives” . On the right side of your screen, there is a meta box, named as Page Attributes.
Scroll through the available options in the drop down menu of this meta box and choose the option Template. Finally, save the page and update it.
4. Listing archive content into a custom page template
With this, you will get a page that will deploy your custom archives page template. However, as there is no content included in the page, it will not display anything.
To showcase your posts on this page, you will need to list your archive content in the custom page template.
For this, you have to do some coding. To help you explain it further, I have taken an example.
This code will list the 10 posts that have been published on a WP site.
<?php /* Template Name: Archives Page Template */ get_header(); ?> <?php $loop = new wp_Query('post_type=post&posts_per_page=10&offset=-10');
while($loop->have_posts() ) : $loop->the_post();?>
<article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
<h1 class=”entry-title”><?php the_title(); ?></h1>
</header><!– .entry-header –>
<?php the_content(); ?>
</div><!– .entry-content –>
</article><!– #post-## –>
<?php endwhile; // end of the loop. ?>
<?php get_footer(); ?>
To help your readers conveniently access your blog posts and navigate with a breeze, an extensive custom archives page template is imperative.
Whether you want to club posts in different categories or want your reader to smoothly browse through your old content, a custom page template for archives make a great choice.
Hopefully, this post will allow you to get started with flair and create a desired custom page template to display archives in a fabulous manner.