Adding a "Posted to Category" Line
The default settings for Movable Type include category archiving. If you assign categories to your posts, you may want to include that information in the "Posted by" section underneath each entry. This is quite easy to do.
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="%"$></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>
</p>
Add the following code before the closing closing p tag of the code above.
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>
</p>
Add the following code before the closing span tag or p tag of the code above.
Posted to <MTEntryCategories glue=" | ">
<a href="<$MTCategoryArchiveLink$>"><$MTCategoryLabel$>
</a></MTEntryCategories>
Save template and rebuild your files.
Comments (3)
If you want to show Cateogry/SubCategory relationships (eg. Parent » Sub), use this code
<MTEntryCategories glue=", ">
<MTParentCategories glue = "» ">
<a href="<$MTCategoryArchiveLink$>"
title="<$MTCategoryDescription$>"><$MTCategoryLabel$></a>
</MTParentCategories>
</MTEntryCategories>
Posted on January 15, 2006
Any idea on how you would only show subcategories?
Posted on March 1, 2006
For the code on the individual archive template, does that only work if the archives are static? I'm using dynamic publishing for my archives, but for some reason can't get the code to work in my individual archive template.
Posted on April 6, 2006