How to create WordPress Archives page

Thursday, January 1st, 2009
Advertisement

Subscribe.
Enter your email:

To create an archives page for WordPress, you can use the Page Template feature. Here are the steps:

  1. Create an empty file—using your favourite text editor— in your theme folder, and name it archives.php, or whatever you like.
  2. Append these codes inside archives.php.
    <?php
    /*
    Template Name: Archives
    */
    ?>
    
    <?php get_header(); ?>
    
    <div id="archives">
    
    <h2>Archives by Month:</h2>
    <ul>
    <?php wp_get_archives('type=monthly'); ?>
    </ul>
    
    <h2>Archives by Subject:</h2>
    <ul>
    <?php wp_list_cats(); ?>
    </ul>
    
    </div>
    <?php get_footer(); ?>
  3. Create a new page in WordPress, and name it Archives.
    Create new page
  4. Change the Template Attributes for Archives page, which is usually located at the right hand side of the Edit Page page,  to Archives (The name will depends on the template name).
    Change the page Template Attribute.
  5. Click on the Update Page button to save.

Now, you already have an archives page by month and by subject/category. By the way, you could also have the archives page to display some or all posts title, as discussed in this article.

If you are new here, you might want to subscribe to the RSS feed or newsletter.

Enter your email address:

Creates the exact copy of your hard disk and allows you to instantly restore the entire machine.
New Acronis True Image Home 2010 is the most reliable and easy in use backup solution. Now with online backup option!
15% Discount Code: FMAATIH2010

What else?

Like this article? Share it

 Digg  del.icio.us  TwitThis  Facebook  Reddit  StumbleUpon

One Response to “How to create WordPress Archives page”

  1. [...] this code, you can list all titles of WordPress posts in one page. An example of usage is in an Archives page. 1 2 3 4 5 6 7 8 9 <ul> <?php global $post; $myposts = [...]

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>