Search »

Show us your Categories

Written by Chris

We last wrote about template tags back in February 2007. Here’s some more stuff you might like to know.

Display your categories

Go to Manage > Files and look in your index.html file. Somewhere, usually in your menu or navigation section, you will see a little piece of code that tells Blogsome to display a list of your blog’s categories. For a basic list, use this:

<ul>{list_cats optionall='1' all='All'}</ul>

For something a bit more interesting, though, take a look at this:

<ul>{listcats sortcolumn=’name’ optioncount=’1′}</ul>

In the above example, optioncount=’1′ will show the number of posts for each category after the category’s name. The number is usually shown in brackets.

Use sortcolumn=’name’ to display categories by name, which is what we do on this blog. If you want to display your categories by their number (go to Manage > Categories, and you will see that each category has a number as well as a name), then you would use sortcolumn=’ID’ instead.

Here are some more options that you can use in that categories code:

  • optiondates=’1′ displays the date of the last post in each Category. Dates take the form YYYY-MM-DD.
  • children=’1′ will show children (subCategories).
  • children=’0′ will not show subCategories.
  • hierarchical=’1′ will display children (subCategories) in a hierarchical (after parent) list.
  • hierarchical=’0′ will not display subCategories in a hierarchical list.
  • child_of=’4′will display only the Categories that are children of the Category that has the ID number ‘4′.
  • exclude=’3 , 7 ‘will exclude the Categories that have the ID numbers ‘3′ and ‘7′ from the list. Obviously, if you want to exclude one or more categories, just change the ID numbers to suit.
  • feed=’rss’ will display a link after each Category to the Category’s RSS feed.
  • feed_image=’PATH/FILENAME’ will display an image link to the Category feed. Substitute the location of an image (usually a small RSS icon) where it says PATH/FILENAME.