« Using PHP and MT Includes | Main | Typepad or Movable Type? »

Category Customizations

One area where plugins have greatly enhanced MT functionality is in categories. Here's a list of some of the things you can do:

How to exclude entries of certain categories from lists of entries.

Say you want to list out your 20 most recent entries in your sidebar, except for the entries in the Special Announcements category. This is easy enough to do with the Exclude Categories plugin. The code would look like this:


<MTEntriesExCat category="Special Announcements" lastn="20">
<a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a><br />
</MTEntriesExCat>


How to list entries only from certain categories.

This trick doesn't require a plugin at all. Just add the category attribute after the MTEntries tag like so:


<MTEntries category="Special Announcements" lastn="20">
<a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a><br />
</MTEntries>

Or

<MTEntries category="Special Announcements AND Music" lastn="20">
<a href="<$MTEntryPermalink$>"><$MTEntryTitle$></a><br />
</MTEntries>

How to show Previous and Next Entry within a category.

On your individual entry archive pages MT by default lists the previous and next entries from your blog. Suppose you only want to show the previous and next entries within that entry's primary category. You'll need to install Phil Ringnalda's PreviousNextInCategory plugin. The code will look like this:

<MTEntryPreviousInCategory>
<a href="<$MTEntryPermalink$>">&laquo; <$MTEntryTitle$></a> |
</MTEntryPreviousInCategory>
<a href="<$MTEntryPermalink archive_type="Category"$>"><$MTEntryCategory$></a>
<MTEntryNextInCategory>
| <a href="<$MTEntryPermalink$>"><$MTEntryTitle$> &raquo;</a>
</MTEntryNextInCategory>


How to exclude a category from a list of categories.

The Filter Categories plugin helps you to include or exclude certain categories from a list of categories.


How to create a link on your Individual Entry to the Category page of the primary category of that entry.

This shouldn't be difficult, but it sure had me stumped trying to figure out how to do it. Thanks to Support Forum contributor Maddy for the clue.


<a href="<MTEntryLink archive_type="Category">"><MTEntryCategory></a>


How to have entries from different categories display different styles.

Say you want the entries on your main blog page to show a different background color depending on what primary category they are in? To do this first create additional classes in your stylesheet with the styling for those categories. For example, if you wanted your entries in your "news" category to be in a green box, add this element to your stylsheet:


.news {
padding: 10px 10px 10px 10px;
background-color: #effbdb;
border: solid 1px #7c9e40;
}

Then in your Main Index template, add the div class


<div class="<$MTEntryCategory$>">

just after the MTEntries tag. Close the tag by adding a

</div>

before the closing MTEntries tag. As long as your stylesheet class name and your category name is the same, you should be able add unique styles to your different categories. Many thanks to LMT reader Mariann for this tip!


Links:

Comments (6)

Danielle:

Multi-category classification -

Does anyone have docs on how to use mulitple category classification on MT? Creating a blog, and would like to have the ability to assign multiple categories to a single entry

Elise:

Danielle - you can assign multiple categories to an entry. Once you've saved an entry in your entry edit window, look at the upper left side, right above the entry body window. Underneath the indicator of the primary category is a link to assign multiple categories. Clicking on that link will open up a new window where you can select additional categories for that entry. Select your new categories and select save. Then select save again for the entry itself.

elise,

hi, i have a category conundrum. is there a way to marge same-named categories in MT? what i want is blog 1 to post about topic A, and also blog 2 i may also post about topic A. i want to list on the main page a merged category on topic A.

multiblog 1.997b doesn't seem to work, and mtsqlcategories is problematic. any ideas?

- andy

Hi,
I have a question for ya about my blog that I am running:
http://blawg.scottandscottllp.com/businessandtechnologylaw/

Its for a group of lawyers and they all want to post under this blog and their posts are all seperated by cattegories. I want to put a profile picture under each category page that they manage.
How would I go about doing that and where would I start?

Thanks

I have a set of categories, and each category has some subcategories. I then create an entry and assign it to multiple categories/subcategories, say for example: parent-cat1, subcat1, parent-cat2, subcat2. parent-cat1 is serving as the primary category.

If I go to a Category archive page for parent-cat1, I see the entry listed. If I click to the entry I want to have a link that takes the user back to parent-cat1 archive page. That's no problem, as you explained above: "How to create a link on your Individual Entry to the Category page of the primary category of that entry."

However, if the user goes to the category archive page for parent-cat2, they also see the entry and can click through to it. But if I put a link to go back to the parent category, it is a link to the primary category (parent-cat1), not parent-cat2. Is there a way to set it so that the link back to the parent category archive is dependent on which sub-category the user is in for the entry?

btw, i am using mt 3.35.

It would be very useful to be able to allow a specific person to create/edit/delete entries, and approve/edit/delete comments, but only for a specific catalog.
Is this possible?

Specifically, I would to create a blog within my larger website, run by an external blogger with complete control over content. Trouble is, I don't want to give that person control over the rest of my site...

Post a comment

(If you haven't left a comment here before, your comment may need to be approved before will appear on the entry. Thanks for waiting.)