Herself’s Webtools

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

Herself’s Webtools header image 1

Entries Tagged as 'archives'

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

Here is a Wordpress plugin to create a link list of all posts in one category

October 12th, 2007 · 27 Comments

This plugin is for Wordpress version 2.3+. Plugin and directions for WP before 2.3

== Description ==
This will create a list of all your posts in one specific category. They will be ordered alphabetically by category.
You can put this as a list in your side bar.

== Installation ==

1) Download, unzip, upload to your plugin directory and active the plugin.

2) In the Admin page find Options->Posts by Category and put in the number of the category you wish to list and click ‘Update Options’

3) Add the following code to your sidebar:

OR

3) Add the following code to a page or post

<!– categoryofposts –>

WP Plugin: Creates Link list of posts for a specific category

You can see this in action by visiting the archives link on this page or my TimesToCome, TimesToCome mobile, houseplants, or Houston Garden site.

** Note (Dec 12th)  I just widgetized this for those of you who prefer widgets. TimesToCome Category of Posts Wordpress sidebar widget

Tags: archives · wordpress

Here is a plugin to print a list of all your posts by category in Wordpress

October 1st, 2007 · 12 Comments

Over time all your posts get buried. If someone visits your blog can that person easily find a post she is looking for? Can someone find a post related to one he is viewing? Wordpress archive pages give you a list of categories and a list of months but no direct links to your posts. You know what they say, 3 clicks and your visitor is gone.

So I wanted an archive that listed all my posts, by category, alphabetically by title. So I started with Frucomerci’s ‘List Posts by Category Plugin for Wordpress and shamelessly hacked his plugin.

The new plugin ArchiveByCategory lists all your published blog posts by category alphabetically.

Download, unzip, upload to your plugin directory and active the plugin.

Oct 17th —————————————————————————–

Ok I’ve been told you’all don’t like hacking your templates. So you can just create a post or page; click the ‘code’ button an add the following line

<!– archivesbycategory –>

Braver folks can follow directions below to hack your template

* thank Rob at Backyard Chickens for letting me know you wanted this.

—————————————————————————————-

Now an archive page is needed. Next you need to hack your template. Open up ‘archives.php’ [ not archive.php ] and find the line

<?php wp_list_categories(’title=0′); ?>

Yours might be slightly different. Remove that line and put in its place:

<?php echo archives_by_category(); ?>

Now all you have to do is create a page - call it ‘Archives’ and select ‘Archives’ as the page template. Nothing else needs to be done but to ‘publish’ the page.

I’ve built in anchor links to the page. It will get very long over time. You will want to create anchor links to each category. ( See How and why you should use anchor links ).

The archives page will update itself with all your news posts as you publish them. Nothing more need be done once this has been set up.

[ check sidebar for newest versions ]
*If you are using Wordpress 2.3 download the ArchivesByCategory V 2.2 I totally cleaned up the MySQL and php and it is easier to read, for you to configure and should run a little faster.

*If you are using an earlier Wordpress version you need ArchivesByCategory V 1.0

If you just want to list one category of posts see:
Plugin to list one category of posts ( WP < 2.3 )
Plugin to create a list of posts for one category ( WP>2.3 )

Tags: archives · hack your template · how to · wordpress · wordpress template

Perl script to build blog archives by subject

September 12th, 2007 · No Comments

I found that lots of people were hunting around the TimesToCome Mobile Blog for posts that weren’t easily findable. You can tell this by looking in your log files. If you see some of your top views are for http://yourblog.com/label/something then people aren’t finding posts. 

Make it easier for them. Add in an archive by subject post and make it easy to find.

I haven’t figured out how to fully automate it but in the meantime, I wrote a couple of PERL scripts, one for Wordpress and one for Blogger that fetch your RSS feed, pull out the links, sort them by subject and stick them in an HTML file. You can open the file in any editor and cut and paste it into a post. You’ll want to re-run it once a month or so and update your archive post.

Blogger archive building tool
Wordpress archive building tool

Directions are in each file, it’s pretty painless. In Wordpress you have to temporarily up your feed count. In both you just have to switch the temp url to your RSS url feed.

See also:
Installing PERL Modules

Tags: archives · blogger · perl · wordpress