Herself’s Webtools

Webtools for Webmasters: Scripts, HowTos, Templates, Plugins, Widgets, Tips and Useful Information

Herself’s Webtools header image 1

Create a separate archives page for each category in your Wordpress blog

February 25th, 2008 · No Comments

I received a request for this on the ArchivesByCategory plugin page. Unfortunately there isn’t a plugin I can write that will paginate the archives one category to a page for you. But it is not too difficult to do with this plugin.

The plugin takes one category number from you and creates a link list of all the posts in that category.

You must create a separate archive page for each category. Since every template is different it is hard to give really detailed directions but I’ll try.In your theme find your archives.php page. Make a copy one for each category. archives1.php, archives2.php etc.

In archives1.php change

Template Name:ArchivestoTemplate Name: Archives 1change<h2>Archives</h2>to<h2>Category 1’s name</h2>Change<?php wp_list_categories(); ?>to<?php echo archive_of_posts(1); ?>

Now you have to do this for each archive page you want, one per category. The above example is for your first category.  For your next category replace the 1s with 2s.Lastly go to your wp-admin->write->page section. Then go to the Page Template drop down menu. You will see an entry for each archive page you made. Create one new page for each template archive entry. Give the page a title ‘Archives for Category 1′ or what ever you wish to call it. Nothing else. The template will fill in the page for you.

Both the plugin and the default WP theme that have been altered are included in the file below. That way you can see what I have done. Do not upload the default theme to your WP site. Just upload the plugin.

The theme is just to make it easier for you to see what I have done.Archives example and plugin

I’ve done this on two of my blogs so far, Herself’s Houston Garden, and Herself’s House Plants. It is much cleaner and a much nicer way of sorting your archives. I hope to have all my blogs updated to this method in the next week or two.

Tags: archives · hack your template · wordpress

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

You must log in to post a comment.