July 16, 2004

Displaying Categories

See the following steps for configuring your weblog for creating and assigning categories, and adding a "Posted to" line at the end of each entry.

Create and assign categories.

When you create a new entry, right next to the Title window is a scroll bar for selecting a category. Scroll down to "Add new category". This will open a window for you to type in the name of the new category. Save your entry in draft mode.

If you have other new categories to add to which you want your entry assigned, repeat the above process with each new category, saving in draft mode after each new category is created. You can assign multiple categories by selecting "assign multiple categories".

Alternatively, you can click on the "categories" button on the left side of your weblog edit window. There are fields for up to five new categories. Enter the categories you want, select save, and then rebuild.

Add a "Posted to" line at the end of each entry.

In the Main Index template, find the following block of code:

<p class="entry-footer">
<span class="post-footers">Posted by <$MTEntryAuthorDisplayName$> at <$MTEntryDate format="%X"$></span> <span class="separator">|</span> <a class="permalink" href="<$MTEntryPermalink$>">Permalink</a>
<MTIfCommentsActive>| <a href="<$MTEntryPermalink$>#comments">Comments (<$MTEntryCommentCount$>)</a></MTIfCommentsActive>
<MTIfPingsActive>| <a href="<$MTEntryPermalink$>#trackback">TrackBacks (<$MTEntryTrackbackCount$>)</a></MTIfPingsActive>

Add the following code before the closing closing p tag of the code above.

<br />Posted to <MTEntryCategories glue=" | ">
<a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$>

Save and rebuild your Main Index template.

In your Individual Entry Archive Template, find the following code:

<p class="entry-footer">
<span class="post-footers">Posted by <$MTEntryAuthorDisplayName$> on <$MTEntryDate$></span> <span class="separator">|</span> <a class="permalink" href="<$MTEntryPermalink$>">Permalink</a>

Add the following code before the closing span tag or p tag of the code above.

Posted to <MTEntryCategories glue=" | ">
<a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$>

Save template and rebuild your files.

Faceted Categories - Pixel's Charmer's method for displaying subcategories. Not for the faint-hearted.
Category Customizations - LMT tutorial
http://www.nonplus.net/software/mt/Per-CategoryTemplates.htm - Per-category template customizations using Supplemental Category Tags plugin

Has this tutorial been helpful? Please consider linking to Learning Movable Type at http://www.learningmovabletype.com/ . Thanks!

Posted by Elise Bauer on July 16, 2004 to Beginner Tips, Categories | Email to a friend | Comments(8) | Printer-friendly version


If you would like to send a trackback
please use the following URL: http://www.learningmovabletype.com/cgi-bin/mt32/mt-tb.cgi/177


Elise, thanks for posting this, that helped a lot.

I do have a related question though, what if I want a category, on an individual entry page, at the top in the navigation there?

Previous / Home / Category / Next

I tried including this code (and a few variations of it that I could think of) there, but it didn't work.

Posted by: Kat at March 23, 2004 01:14 PM

Hi Kat,
It probably needs to be within some container tag. A great place to pose questions like this one is in the Movable Type Support Forum. http://www.movabletype.org/support/.

Posted by: elise at March 23, 2004 08:05 PM

Any tips about creating and displaying subcategories in MT? This will be og great help for me.

Posted by: mcse at May 21, 2004 08:24 PM

MCSE - I use Pixel Charmer's steps for Faceted Categories posted here: http://www.pixelcharmer.com/fieldnotes/archives/process_designing/2003/000348.html
It is a little dense to figure out, you have to follow the instructions precisely or the code won't work. Other methods exist, but they require more technical expertise than I have.

Good luck!

Posted by: elise at May 21, 2004 08:59 PM

Seen David Rayne's SubCategories (http://www.rayners.org/archives/blogging/movable_type/mt_plugins/subcategories/) They are incredibly useful and should've been built into MT rather than requiring yet another plugin!

Posted by: Arvind at July 17, 2004 01:48 AM

I figured out why the category names are underlined all the way to the pipe character {|}: the code that you suggest pasting in number 4 above has a space between the $MTCategoryLabel$ and the ending anchor.

I also added the "posted to" code to the Category Archive template. Very useful, when viewing one category, to see to see what other categories those entries are assigned.

This site is GREAT! thanks!

Posted by: cindi at August 23, 2004 05:32 PM


great tutorial! i used it way back when i first installed 2.661 and all worked perfect. i just upgraded to 3.1 and am wondering if you could shed a little light on how to list sub-categories in the sidebar, exactly as was illustrated in this tutorial for categories?

thanks much! :)

Posted by: evan at September 17, 2004 03:18 PM

Hi Evan - I haven't figured out subcats yet. But when I do, most likely I'll write something that ends up here. In the mean time, you may want to check the forums. Or, if you figure it out before I do, drop me a line and let me know what you learned. Thanks!

Posted by: elise at September 17, 2004 04:24 PM

Comments are now closed for this entry.

Email to a friend

Email this article to:

Your email address:

Message (optional):