Beginner's Guide for WordPress - Start your WordPress Blog in minutes.
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
WordPress Plugins
View all Guides

How to Create a Custom Archives Page in WordPress

Last updated on by
Special WordPress Hosting offer for WPBeginner Readers
How to Create a Custom Archives Page in WordPress

Custom archives page is a great way to bring together all your old content in one page. It allows you to have a dedicated page where you can list your monthly archives, category archives, tag archives, author archives, and anything else that you might want to add. We have a custom archives page for WPBeginner. Recently one of our users suggested that we write a tutorial on that. In this article, we will show you how to create a custom archives page in WordPress.

The Problem

By default, you have the ability to display your yearly archives by using sidebar widgets. This can get out of hands once you have been blogging for more than a year. Imagine sites like WPBeginner that have been active for nearly 4 years. We would have 48 monthly archive links in the sidebar. You also have the ability to add category archives, author listing, etc on your sidebar. But why clutter the sidebar with so many links when you can create a single page to list them all. This is when a custom archives page come in play. Not only does it allow you to avoid clutter, it also provides your users with an efficient way to browser through your older content.

Sadly, most WordPress themes do not come with a custom archives page template. Let’s look at what you need to create a custom archives page template in WordPress.

Note: Please do not confuse the custom archives with archive.php template that comes with most WordPress themes. The archive.php template is used to display monthly, category, tag, author, and other archive pages. Our custom archives page would be a single page that will bring all of your other archives together.

Creating a Custom Archives Page Template

First thing you need to do is to create a page template for the custom archives page. Simply open a new file in your text editor (i.e Notepad) and name it page-archive.php. Next, Add the following lines of code at the top:

Template Name: Archives

Upload the page-archive.php in your WordPress themes folder, and you have created an Archives page template. Now we need to make sure that this page template matches the design of your site. Copy the content of your page.php file located in your theme’s fodler and paste it in page-archive.php.

Below is an example of how your page-archive.php file would look like:

Template Name: Archives
get_header(); ?>

<div id="primary" class="site-content">
<div id="content" role="main">

<?php while ( have_posts() ) : the_post(); ?>
<h1 class="entry-title"><?php the_title(); ?></h1>

<div class="entry-content">

<?php the_content(); ?>

/* Custom Archives Functions Go Below this line */

/* Custom Archives Functions Go Above this line */

</div><!-- .entry-content -->

<?php endwhile; // end of the loop. ?>

</div><!-- #content -->
</div><!-- #primary -->

<?php get_sidebar(); ?>
<?php get_footer(); ?>

Creating a Custom Archives Page in WordPress

Now that you have the basic page template ready, you need to create a new custom archives page in WordPress. Go to your WordPress admin panel and add a new page (Pages » New). You can call this page Archives, Library, or anything else that you like. Now look at the meta boxes below the publish button on the right hand side of your screen. You should see a meta box called Page Attributes. Click on the drop down menu below Template and choose Archive as your page template. Save and Publish the page.

Select Archives Page Template in WordPress

Now you have created a page that uses the archives page template, however it will not show any content. Let’s go ahead and add custom archive page elements such as yearly archives, categories, etc.

Adding Monthly Archives with Compact Archives

If you look at our custom archives page, then you will notice that we are not using the default monthly archives listing that comes with WordPress. Instead, we are using a plugin called Compact Archives. Note we have adopted this plugin and are now maintaining it.

Install and activate this plugin the Compact Archives plugin. After activating the plugin, add the following code in your custom archives page template (page-archive.php):

<p><strong>By Date</strong></p>
<?php compact_archive($style='block'); ?>

It will display your monthly archives like this:

Displaying monthly archives one year per row using Compact Archives

Adding a List of all Categories

Categories summarize the main topics of your website and are the best way to sort your content. See why how we use Categories vs Tags. Since we are using categories as the main way to organize our content, we think it is absolutely crucial to list our category archives. To save space, we are going to display it an inline list.

First add this code in your archives page template file:

<ul class="bycategories">
<?php wp_list_categories('title_li='); ?>
<div class="clear"></div>

Now we need to style this list, make it appear inline and improve their look. Add this to your theme’s style.css file:

ul.bycategories {
margin: 0;
padding: 0;
ul.bycategories li {
list-style: none; 
list-style-type: none;
margin: 0; 
padding: 0;
ul.bycategories li a {
list-style: none; 
list-style-type: none;
margin: 0 20px 15px 0; 
float: left; 
background: #eee; 
color: #464646; 
padding: 5px 10px;
border-radius: 5px; 
-moz-border-radius: 5px; 
-webkit-border-radius: 5px;
ul.bycategories li a:hover{
text-decoration: none; 
background: #ff6200; 
color: #fff;
.clear{clear: both;}

Your categories will look like this:

Displaying in line categories on archives page in WordPress

Explore? Redirect Users to a Random Post

In our archives page, we have an Explore WPBeginner button. This button redirects users to a random post. The purpose is to allow users to randomly stumble through articles. Learn how to redirect users to a random post in WordPress.

While this is all the information that we have on our custom archives page, you can most certainly add more. Let’s look at some of the other things that you can add.

Adding a Tag Cloud

If you want to display a tag cloud of your most popular tags used on the site, then simply add the following code in custom-archive.php file:

<p><strong>Tags Cloud:</strong></p>
<?php wp_tag_cloud(); ?>

The wp_tag_cloud() function comes with a lot of parameters to adjust the number of tags, maximum and minimum tag sizes, etc.

Adding a List of Pages

If you want to display a list of all pages on your site, then simply add the following code:

<?php wp_list_pages( 'title_li=' ); ?>

Adding a List of Authors

To display the list of authors on the site, simply add the following code:

<?php wp_list_authors( 'exclude_admin=0&optioncount=1' ); ?>

Adding Recent Posts

If you want to display a list of your most recent posts, then add this code:

<?php wp_get_archives('type=postbypost&limit=10'); ?>

A comprehensive archives page allows your users to efficiently navigate through your old content. We hope that this article helped you create a custom archives page in WordPress. If you have any questions or suggestions, then please let us know by leaving a comment below.

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Page maintained by Syed Balkhi.

WPBeginner's Video Icon
Our HD-Quality tutorial videos for WordPress Beginners will teach you how to use WordPress to create and manage your own website in about an hour. Get started now »


  1. Andry says:

    Hi !

    I’m preparing a news site with WP theme but I have a GREAT question about archives, maybe you’d be able to give me your opinion thanks to your experience.
    The site must give a new version everyday (relating to the paper edition) and offer an archive page which allows to find the old editions as it was published the day ‘d’. Plugins in WP allow only to have articles by date, so we have a list of the old artilces for a specific date but not the whole edition (a complete copy of the site as it was published at a ‘d’ date). Do you know any plugin for WP to ‘make a copy’ of a site so it’d be possible to link every ‘copy-date’ with a date in the calendar table? or an archive plugin to have automaticly the old editions ? Is it possible to have a folder (in the WP repertory) which contains all the articles of an edition ? so I can link each folder to a date in my calendar table ?
    – Do you have in your favorite lists a good WP theme for newspaper ?
    Thanks in advance !

  2. Aaliya Thahseen says:

    Upload the page-archive.php in your WordPress themes folder, and you have created an Archives page template.

    I am having difficulty with this part. How do I upload the page-archive,php in the wordpress themes folder?

  3. dwieyoko says:

    how to create search form and display search result on archive.php.. ?

  4. Kyran Wallace says:

    Hi there

    This worked great for me! Thank you.

    One thing though, My list of archives will not show on mobile devices. I am currently running the WPTouch plugin for mobile users.

    Could you advise how to resolve this please?


  5. Pete says:

    Hi, is there a way just to list certain categories i.e. exclude some categories from the list?
    Thank you.

    • WPBeginner Support says:

      yes you can use wp_list_categories function like this.

      <?php wp_list_categories('exclude=4,7&title_li='); ?>

      Replace 4,7 with the IDs of categories you want to remove.

  6. loic says:


    I have registered different CPT.

    I have created a page template which list posts for a given CPT.

    I have put a query (query_posts(‘posts_per_page=-1&post_type=my_cpt_one’); before the loop.

    Than I have selected the page template when creating the page archive of the given CPT.

    How to use the same page template for each CPT?

    For example, I want three page archive named “my cpt one”, ‘my cpt two”, “my cpt three” which calls the same page template.

    Of course, i could use three page templates, but I’m looking for a way to use only one page template.

    My problem is to set in the query the post type slug.

    Is that possible?


  7. Avdhesh Arya says:

    Thanks so much! This has helped a lot in creating a custom Archives page for my website.

  8. WPBeginner Staff says:

    That’s because template tag wp_list_categories generates a bulleted list of your categories by default. Child categories are displayed indented under their parent categories. You can use
    &lt?php wp_list_categories('title_li=&style=none'); ?> to display your categories with line breaks.

  9. Cara Zimmerman Seekell says:

    My categories look sort of all over the place, any idea why?

  10. yasinatagun says:

    Cant we make it without plugin? I just want to list my all of posts in one page. No matter there is 10000 posts or 2 post. i just want to list ?

  11. Luca says:

    I would like to create an yearly/monthly archive of a specific category. Is it possible using with a filter for a specific category?

  12. April says:

    I am looking high and low for my themes folder… I know a
    little more than basic for coding, but working with WordPress has been
    difficult for me trying to find everything. Maybe it is not compatible with
    what I have.

    I am trying to have a page on my blog for a list of Archived
    blog posts that looks like this: with year,
    month, and categories. I have a lot of posts. I tried the plugin
    for Archives and created a page and added [archives] and all I got was a whole
    list of all my blog post titles. It was long.

    I found this post
    but I cannot locate a themes folder in wordpress. Maybe I have the wrong set

    I am hosted with one of the outside WordPress recommended
    hosts using WordPress for my blog. My theme is Twenty Ten.

    If someone could help me get the result I am looking for,
    that would help me a lot. Thanks!

    • Essekia Paul says:

      If anyone is looking for an answer to this. The path is :

      WordPress root folder -> wp-content -> themes -> Twenty Ten

  13. Member At Blc says:

    I have added the archive page to my site but I only want to see the date / categories and archives in the members only section Is this possible?

  14. Member At Blc says:

    I have just added archive page to my site but want the posting pages, dates and categories hidden and only visible when you log in. My post pages currently show blocked but I see them in public view. Can these be hidden???

  15. Avinash says:

    Works Perfectly, When I tried to add &show_count=1 then the count breaks the category listing .. can you help with the css needed for the count to display properly.

  16. Pawan Kesari says:

    Very helpful. I have just added archive page to my blog site
    Question: Would this template file get deleted during theme upgrade?

  17. Charlie says:

    Nice howto, but is there any way to manage something like this in a plugin?

  18. Nicole says:

    I love this tutorial! However, I want my tag cloud to be separated by commas. Here’s the code I used for the tag cloud (I don’t want the font sizes to change so I kept the smallest and largest at the same size)…


    Any tips?

    • WPBeginner Support says:

      Your code was stripped by WordPress comments. This snippet should work:

       $args = array(
          'smallest'                  => 8, 
          'largest'                   => 22,
          'separator'                 => ','
  19. voltima says:

    Thanks a lot for a very easy to understand ‘how-to’.

  20. Thomas says:

    Hi, thanks for the great tutorial!

    I did set-up the list of all categories which looks perfect. The only problem I have is that if I add any content to that page, the list of all categories is always placed at the bottom. Is there a way how I can set it to the top of the page?

  21. Archurst O. A says:

    Is there a way to show per day or week instead of the monthly archive style?

  22. sameera says:

    Thanks. Grete work.

  23. Nad' says:

    Hello guys,
    First of all, thanks for this amazing website. I have used this post to create the archive but since yesterday the archive page is no longer working. I have not changed the code and now the only thing I see is By date. after that, I cannot see anything, not even the sidebar or the footer.
    My template is running locally as I am building it. Any idea what could have caused that?


    • WPBeginner Support says:

      seems like a coding error in your template is breaking the template right after it displays your archives by date.

  24. meki says:

    I copied your given code but my site is not showing any kind of archives. Your code has an error. 0n line # 16 you are closing ?>php then starting html, which will simply print html on page. I activated plugin, corrected the code but still my page is empty. Let me correct, thanks.

    • Meki says:

      I do not have a page.php as well.

      • Meki says:

        any reply?

        • WPBeginner Support says:

          Meki, we are sorry but we are unable to understand the issue you are facing. As for page.php file you may be using a Theme Framework so your theme may not show a page.php file. Please contact your theme author and ask them which file you should use as the base for your custom page templates.

  25. Craig Parker says:

    Awesome. I’ve got to bookmark it and come back, but an archves page is something I’ve been wondering about for a bit now.

  26. Kelly says:

    Great tutorial. Could you clarify something before I begin. I’m using a child theme. Should I add the page-archive.php file within the folder of the actual “theme files” or should I place it within the child-theme-folder? Likewise….Now we need to style this list, make it appear inline and improve their look. Add this to your theme’s style.css file. I’m going to assume I can add this within my child-theme as custom css; is that the correct approach?

  27. gary bvings says:

    I’d like to combine the two archive display ideas above. I have two categories: Cars and Boats. I’d like to show the monthly archives ( with the Compact Archive plug-in) for each. What php do I use? Thanks.

  28. Maschil says:

    Great tutorial — thanks :) It has worked perfect!

    I copy and pasted the css provided into my css file and it did not change the look at all. Thoughts?

  29. Kate Reid says:

    Thanks so much for this really useful post. I’ve just started using a really minimal theme, so this custom archive page is perfect to help navigation. It’s looking good!

  30. nicole holgate says:


    Great plugin and easy to use.

    I am trying to use it for a custom posts archive page (only the custom posts to be listed in years, by month.

    Does this work with custom post types at all? Currently it is only listing regular post types.

    With thanks :)


  31. Emily says:

    Ok I think I’ve figured out where to upload it, but now it’s not supporting my notepad file.

    • WPBeginner Support says:

      Make sure that your file name is page-archive.php and not page-archive.php.txt or page-archive.txt

  32. Emily says:

    I do not understand where to upload my page-archive.php file. Where is the WordPress Theme folder?

  33. Sheeba Yousuf says:

    I have created Archives.php and when on the page i click on the archives i don’t get which template is the posts using (custom posts) ,its a mess actually. Could you please help.

  34. Chris Raymond says:

    i see you are using the_content in the loop, but when you click on a month and see the posts, it is only showing a snippet. Is that controlled via another custom function? Could I instead use the_excerpt?

    TIA, very useful post

  35. real name says:

    good work man …kepp it up

  36. Atanas says:

    Well… This post is quite useful but I got problem… I have Thesis 1.8 theme and I am not able to find page.php file in my theme folder …. Sad… Any ideas…

    • WPBeginner Support says:

      Thesis is a theme framework you need to check Thesis Documentation to learn how to make these changes.

  37. Saranya says:

    Great tutorial. It helped me a lot as a beginner. Thank you so much.

  38. Syed Irfan says:

    Syed, you are doing a great job for the beginners, and I think its a great service specially for the very non skilled just like me. Masha Allah and JazakAllah!

  39. Carol says:

    Is there any way to limit the output from Compact Archives to one category of posts instead of all posts?

  40. Kenny says:

    I found it too difficult to add to a Woo Theme. The Woo Framework page.php is too complex to work out where the additional Compact Archives code goes. It doesn’t have a nice commented slot as does the sample in the example.

  41. Nusa Herba says:

    We’re trying to create something like this, thank you for the tutorial, very useful.

  42. Kenny says:

    So timely! In the last fortnight I have been frustrated at how difficult it can be to view archive posts in time sequence and some other ways. And I wondered whether my readers were having the same issue. I’m not into adding code but will make an exception in this case. Thanks.

  43. Amy says:

    Nice tut!

Add a Comment

We're glad you have chosen to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and all links are nofollow. Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.