Creating Helpful and Effective Wordpress Archives

header

One of the most important elements of your blog, is the content that you painstakingly put together to gain readers and keep the online masses surfing your waves. So why do so many bloggers not take the extra time and give more attention to their archives?

Afterall, without an easy to navigate archive section, then all of that great content that you crafted will become lost in the backpages of your post progression as you continue to crank out the content. It seems that once a post has served its initial use for us, that we carelessly discard it to the forgotten areas for the post to die, rather than institute an accessible archive that will allow those past posts to continue to deliver the punch you packed within.

Our archives allow for an overall easier experience for our readers, by giving them simple access to the content they are looking for. Or more to the point, the information that they do not know they are looking for.

What I mean by that, is this. On occasion, we have users come to our site without a specific target in mind, they are simply browsing for interesting reads. By setting up a thorough collection of your posts, those browsers will have a much easier time surfing for a destination among your archives, keeping the reader engaged and skimming through the content that could have easily fallen through the cracks.

So in this post, I am going to offer some pointers on creating a quality archive section for your blog that will serve as an inspired homage to the awesome content that it contains.

Creating a Template

The first thing you will need to do is to create a Wordpress Page Template for your archives page. Here we’ll be creating archives.php in our wordpress theme folder.

So here’s the code we are going to start with, then I am going to give you some options to actually customize the page the way you want it.

NOTE: Since the Template Name is Archives, the page must be named archives.php.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?php
/*
Template Name: Archives
*/
?>
 
<?php get_header(); ?>
 
<div id="archives">
 
	This is where we will actually be building the archives page.
 
</div>
 
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Posts by Date

While listing archives by date isn’t usually that helpful for finding a particular post or topic, it is a good way to establish your blog (remember that longevity = reader confidence). I recommend simply listing these archives by month to conserve space.

The following code will list the archives by month with no limit to the number of months it will display.

1
<?php wp_get_archives(); ?>

The following code lists the archives by month displaying only the past 12 months.

1
<?php wp_get_archives('type=monthly&limit=12'); ?>

You can set the type and limit to whatever your preference is. You can find more information about your options for parameter settings at the Wordpress Codex Get Archives Page.

Posts by Category

This will be the most important section of your archives since most readers are not looking for a particular date but for a specific topic.

If you just want to generate a list of your categories use the following code.

1
<?php wp_list_categories(); ?>

If you would like to exclude certain categories (for example, blog updates) use this code. In this example, categories 10 and 12 will be excluded. To find the id for the category you want to exclude, go to your admin area and go to Posts > Categories. Right click on the category you want to exclude and go to Properties. The category ID number will be at the very end of the address line.

1
<?php wp_list_categories('exclude=10,12'); ?>

If you would like to show posts from each category, a great plugin that I use on Arbenting is Latest Post from each Category. With this plugin you can choose how many posts from each category you would like to display including the option to list every post from each category.

Most Popular Posts

It is always helpful to direct your visitors to your most popular posts because the content has proven to connect with a range of people. For this you will need the Wordpress Popular Posts Plugin.

Then place the following code wherever you want to display your most popular posts. This default will have an h3 header ‘Popular Posts’ and will list 5 posts via their linked titles.

1
<?php if (function_exists('WPPP_show_popular_posts')) WPPP_show_popular_posts(); ?>

You can also alter these parameters with the options listed at the plugin’s FAQ page.

For example, the following code will have the h4 header ‘Our Most Popular Articles’ and will list 10 posts via linked titles as well as the number of views the post has received.

1
<?php WPPP_show_popular_posts( "title=<h4>Our Most Popular Articles</h4>&number=10&format=<a href='%post_permalink%' title='%post_title_attribute%'>%post_title% (%post_views% views)</a>" );?>

Most Commented Posts

Highlighting your most commented posts will direct your readers to the most active discussions on your blog, sparking more interaction with your audience which is always beneficial in building a strong readership.

First, you will need to install the Most Commented plugin.

Then insert this code wherever you would like the posts listed. This will show the 5 most commented posts on your blog. You can also alter this number to however many articles you would like to display.

1
<?php mdv_most_commented(5); ?>

Highlight Your Favorite Posts

If highlighting posts that are your personal favorites is a route you want to go, you will need to create a category titled something like Favorites, and then add all of the posts you want listed here into that category. Using the following code will list all posts in your ‘Favorites’ category.

1
2
3
4
<?php $my_query = new WP_Query('category_name=Favorites'); ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
<?php endwhile;?>

A Search Box

And just in case the reader still does not find what they are looking for on the page, it is nice to provide them with a search box.

If your theme doesn’t already have a searchform.php file, you will need to create it. Simply paste the following code into a new text file and save it as searchform.php in your theme folder.

1
2
3
4
5
6
7
<form id="searchform" method="get" action="/index.php">
  <div>
     <input type="text" name="s" id="s" size="15" /><br />
     <input type="submit" value="Search" />
  </div>
</form>
</li>

Then, paste the following code wherever you want the search box to appear in your theme.

1
<?php include (TEMPLATEPATH . '/searchform.php'); ?>

Wrap Up

So, here is our final archives page template. Obviously you will need to create some styling elements to style the page to match your client’s theme.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
/*
Template Name: Archives
*/
?>
 
<?php get_header(); ?>
 
<div id="archives">
 
	<h3>Monthly Archives</h3>
	<?php wp_get_archives(); ?>
 
	<h3>Archives by Category</h3>
	<?php wp_list_categories(); ?>
 
	<?php WPPP_show_popular_posts( "title=Posts by Popularity&number=5&format=<a href='%post_permalink%' title='%post_title_attribute%'>%post_title% (%post_views% views)</a>" ); ?>
 
	<h3>Most Commented Posts</h3>
	<?php mdv_most_commented(5); ?>
 
	<h3>My Favorite Posts</h3>
	<?php $my_query = new WP_Query('category_name=Favorites'); ?>
<?php while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a>
<?php endwhile;?>
 
	<h3>Search the Blog</h3>
	<?php include (TEMPLATEPATH . '/searchform.php'); ?>
 
</div>
 
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Now that you have the template complete, upload it to your theme folder, log in to wordpress admin and create a new page. In the right hand column you will see Template listed under Attributes. Choose the Archives page, give the page a title and simply publish.

What have you done with your archives page? Feel free to show off links in the comments!

Share

  1. I’ve just done the complete listing. Simple yet a lot of people hae found it useful.

    http://churchcrunch.com/archives/

  2. Great post – I’m starting to build up my archives and this’ll be very helpful in the future.

    • Angie Bowen (57 comments)23 November 09

      Thanks a lot! I hope it comes in handy while you’re building your archives :)

  3. Good post. I currently don’t have an archived page on my blog. Will refer to this post once I decide to add it on. Thanks!

  4. Nice share I will also refer to this in the future. It looks very handy. Thanks for sharing.

  5. This is a helpful tip, but one thing to keep in mind is that having 100s or 1000s of links on one page can be bad for search engines. I would consider restricting the archive page you create by either robots.txt or the robots nofollow, noindex meta tag. But a great usability tactic nonetheless.

    • Angie Bowen (57 comments)23 November 09

      Thanks so much for this tip, it’s not something I had thought about before but I’ll definitely be excluding my archives page from search engines now.

    • Mark there is a plugin called Nofollow archives.You can do this with the help of this plugin.

    • Actually, if you use the plugin Headspace 2 (it’s free) then there’s no need to nofollow your archives as it keeps you from getting duplicates as well as making google think your spamming. And that way, you’re have equal pagerank on all of your pages.

  6. very useful

    thank you

  7. Angie Bowen (57 comments)23 November 09

    Thanks for all of the comments everyone! I’m glad you’re all finding the tips useful :)

  8. Useful :) , will refer in future

  9. yeah, Effective Wordpress Archives is important.

  10. EGA (1 comments)24 November 09

    what about archives by post tags?

  11. I use pretty much the same setup on my archives page for Guerrilla Freelancing. A little bit of everything, the person is sure to find what they’re looking for :)

    http://www.guerrillafreelancing.com/archives/

    I need to update it though with a two column layout for the categories and monthly archives, so the page doesn’t stretch so far down the page.

    Cool post Angie :)

    • The two column layout is a good idea for blogs with a lot of content, might try that out here sometime as well! :)

    • Angie Bowen (57 comments)2 December 09

      That is a great idea Mike! I still need to do some work to Arbenting’s archives (I’m like a carpenter who’s house needs work hehe) and will look at implementing a 2 column archives page.

  12. Really Nice Post Angie

  13. Wow, excellent post and very detailed. I usually pay minimal attention to my archives page but I suppose maybe I should reconsider. I just figure people don’t really visit it. But of course for the sake of good design it’s good practice to make it as functional as possible for those who do use it. Oh and as far as the duplicate content issue, you could also use canonical tags rather than nofollowing/noindexing the whole archive. -Rob

    • Angie Bowen (57 comments)2 December 09

      Thanks for the tip on Canonical tags, I’ll definitely look into that.

  14. chris (18 comments)26 November 09

    Thank you, easy to follow and understand

  15. Can i use this format to my blog, that is blogspot

    • Sorry, the code examples here only work for WordPress. You could achieve the same effect in Blogger most likely, but the method to do it would be different.

  16. Very good post. Old posts are far too often overlooked. Including a note in your about page linking to some of what you have above is a good idea. I agree completely that you want to make it easy for a new visitor to find other content they would like. Related links in the post, categories and popular posts are 3 great ideas.

  17. Carik (2 comments)28 November 09

    Not bad. The unique complete site map for visitors, but not for poskovikov! The only thing even individual styles prescribe.

  18. Aziq (1 comments)30 November 09

    Nice.Simple and yet useful.

  19. Thanks Angie,
    I am guessing if i want to show a specific post i should do the following:

    [code]

    <a href="" rel="bookmark" title="Permanent Link to ">

    [/code]
    Am i right??

    Thanks again.

    • Angie Bowen (57 comments)2 December 09

      Yes, you can do specific posts that way, though anytime you want to change the post, you’ll have to manually edit your archives page. You can also use the technique outlined under “Highlight your Favorite Posts” so that anytime you want to change the posts listed, you just have to change the posts categories.

  20. I am sorry seems that the php code sample has been removed.
    I meant if i did change:
    new WP_Query(‘category_name=Favorites’)
    To
    new WP_Query(‘post_name=myPostName’)
    I should be able to show a specific post! Am i right?

    • Angie Bowen (57 comments)2 December 09

      Hmm, I’m honestly not sure about this. Let me look into it and I’ll try my best to answer :)

  21. Sweet blog! I love the design here and I’m really impressed with the post, keep it up

  22. Looks like a very clear explanation. Creating Wordpress templates is something I should have learned earlier. I’ll give it a start with this tutorial!

  23. I love this tutorial, you really need to have a lot of ways to sort or search archives.

  24. Thanks for the information. I leave a TON of posts on my blog (sometimes two a day) so having a good way to archive them in a must.

    The old way I was doing it was horrible to say the least. Your tips here are going to make my blog much more enjoyable for my readers. Thanks a lot.

  25. It´s really important to have a good organized archive otherwise the readers will loose their interest if it´s to hard to find.

  26. Shaun (2 comments)3 December 09

    Thanks a ton for this post, it has been very useful.

  27. awawaw…
    yess.. i need this tutor.. thank for share

  28. aks (3 comments)12 December 09

    nice post thanks for sharing this.

  29. aks (3 comments)12 December 09

    thanks for post really nice.

  30. This is a great post but the problem is I am unable to find Page Template option in my page admin panel. I am using Wordpress v2.8.6.
    Maybe I thing its a bug in version.

  31. The most useful archives should be on Magazine Themed blogs, this advices/codes are pretty cool and very useful, I’m just going to say thanks a lot for this post.

  32. Why not use the SRG Clean Archives plugin which lets you list every post by month and comments as well?

    Currently, I don’t have an archives page on my blog, which is hosted by Wordpress.com. However, my new upcoming site should have an archives page because it will be powered by self-hosted Wordpress.

    I like the tips and that you wrote the code yourself! No need to change anything for us non-techies. :-)

    I’d love more Wordpress tutorials like these to be posted here more often. In my opinion, list posts have been done enough here. Thanks again for the code!

  33. hi, thankx for the post.

    But i have a Problem. on my website [ http://gfxtutor.co.cc/archives/ ] whn i click on ARCHIVES it opens Contact form page. !!! how do i solve it !

    Im using name Permanent link style.

  34. Thanks for the tip. I’ve never been happy with my archive and am going to try and incorporate this.

  35. Mario (1 comments)24 January 10

    Thanks, Angie, for the tip! It is very nice of you for sharing that with us!

  36. Grant (13 comments)25 January 10

    If you’re using any sort of content management system to blog, then you need a usable and efficient archiving system, or your new visitors will not be able to find your older content without trawling for hours. No-one wants to do that. All it takes is a sensible search function and the breaking down of older blogs by month/year and/or category.

Leave a Comment

Your reply will be added to the comment above (Below any other replies to this comment) -

(We DoFollow)

Not sure how to get an image with your comment?