Home » WordPress

How To Create An Archives Page

Posted By: Tuesday 6 May 2008 3 Comments

Having an archives page for your WordPress blog is something very important. In an archive page you can archive links listing by categories, months, year and pages.
Most free WordPress themes already have an extra page template for an archive page. Just look in your theme’s folder for an php file called archives.php. This is different then your default archive template which is called archive.php (without the “s”).

But if you have a theme which doesn’t have an archive page, you can make one your own very easy when you follow this steps. I take my own archive page as an example.

  1. Make a copy of your index.php and call it archives.php. This is just to preserve your theme structure!
  2. Open the file and type this at the top of the Archives.php
  3. Now remove the original loop code in the index.php.
  4. Add the category listing by inserting this code:<h2>Archives by Categorie:</h2>
    <ul><?php list_cats(0, '', 'name', 'ASC', '/', true, 0, 1); ?></ul>
  5. Add the month listing by inserting this code:<h2>Archives by Month:</h2>
    <ul><?php wp_get_archives('type=monthly'); ?></ul>
  6. Add the page listing by inserting this code:<h2>Archives by Pages:</h2>
    <ul><?php wp_list_pages('title_li'); ?></ul>
  7. Save the archives.php file, upload it to your theme’s folder (wp-content/themes/themename/).
  8. To use your archives page you have to create a new page and select your newly upload Archives page template for that page!

If you enjoyed this post, please consider leaving a comment or subscribing to the RSS feed and I'll deliver the future articles to your feed reader.
Behrad

About Behrad:

I'm 29 years "old", married to Jannie and about to be a daddy! We live happily in Eindhoven, The Netherlands.
In 2006 I started BioTecK.net just to show/share my portfolio. After a while I started to blog about my experiences and stuff I do in my life, my interests; computers & computer related stuff, tips & tricks and basically everything which I want to share.
Read more about me, follow me on Twitter @BioTecK or contact me .

3 Comments so far, be the next one! »

  1. Pixel Shoppe says:

    Hi, thanks for dropping by and commenting. It is always appreciated. Cool post, I had a hard time figuring out how to make an archive. :oops:

    Pixel Shoppes last blog post..Vacation Rentals

  2. BioTecK says:

    Hello Pizel Shoppe,
    Glad that I could help you!! Making an archives page is very easy as you can see! :D

  3. [...] to show / share my portfolio. However along the way I was forgotten all about this. So I created a template for my portfolio page and will start improving this even further. With this I also noticed that I [...]

Leave a Reply

All line breaks and paragraphs will be generated automatically.
BioTecK.net is a Gravatar-enabled blog. To get your own avatar, please register at Gravatar.
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>

Notify me of followup comments via e-mail. You can also subscribe without commenting.