You're here: Home » WordPress » Perfect Archives page template for WordPress

Perfect Archives page template for WordPress

On Aug 29, 2010 under WordPress

Many of the basic WordPress themes doesn’t have a custom Archives page template. Last week I was creating few pages in my blog and I also wanted to make a archives page. I saw that my theme had a archives page template and I modified it a little bit to suit my needs. Immediately I used the modified code for my other blogs where I don’t have archives page and I was easily able to add it in all my blogs. So I thought this archives page template coding would be useful to many of you. Let’s see the steps.

Related Read:

Creating Custom WordPress Page Template

Custom WordPress Login Page

How to make Archives Page Template – Step by Step

Step 1: Open notepad, place the complete following code and save it with some name such as archives-template.php.

[php]
<?php
/*
Template Name: Archives by Webfroze
*/
?>

<?php get_header(); ?>

<div id="content">

   <h2><?php the_title(); ?></h2>

      <div class="entry">

            <!--Monthly Archives-->
            <h4>Month Wise Archives</h4>
            <ul>
            <?php wp_get_archives('type=monthly'); ?>
            </ul>

            <!--Categories Archives-->
            <h4>Category Wise Archives</h4>
            <ul>
            <?php wp_list_categories('title_li='); ?>
            </ul>

            <!--Latest 50 Posts-->
            <h4>Our latest 50 Posts</h4>
            <ul>
            <?php wp_get_archives('type=postbypost&limit=50&format=custom&before=<li>&after=</li>'); ?>
            </ul>

      </div>

</div>

<?php get_sidebar(); ?>

<?php get_footer(); ?>
[/php]

Step 2: Next move the file to your WordPress theme folder where you have all the theme core files such as header.php, footer.php etc.

Step 3: Now create a new blog page. Enter the page title. At the right side of your page under template you can see “Archives by Webfroze” option. Just click on that option and publish the page.

Archives Page

WordPress Archives Page

That’s it. Your WordPress Archives Page is ready. You can modify the code as per your needs and make the archives page to look more impressive.

Comments on this entry (6 comments)

Did you like this post? You can share your opinion with us! Simply click here.

  1. Mahesh says:

    It’s a good way to create archive page, without any plugin. Thanks for the tutorial !

Leave a Reply

CommentLuv badge