Hi
My website is http://www.theSarayiahpost.com and I am thinking about having the categories I have created displayed on the main index page. Can someone tell me how to do that please?
Thank you.
Kind regards
Isaac Sarayiah
Reported on Movable Type 5

~x(
<h2><$MTCategoryLabel$></h2>
<ul>
<MTEntries>
<li><a href="<MTEntryPermalink>"><MTEntryTitle></a></li>
</MTEntries>
</ul>
Hi Isaac,
Discard Masoud coding above, because that is for listing the current category name and the entries under it in a category context.
What you need is:
You may like to use the following coding if you want to list all categories that have at least one item under them:
<ul>
<mt:Categories>
<li><a href="<mt:CategoryArchiveLink>"<mt:If tag="CategoryDescription"> title="<mt:CategoryDescription remove_html="1" encode_html="1">"</mt:If>><mt:CategoryLabel> (<mt:CategoryCount>)</a></li>
</mt:Categories>
</ul>
If you want to display also the ones without no entries associated to them, then use:
<ul>
<mt:Categories>
<mt:If tag="CategoryCount">
<li><a href="<mt:CategoryArchiveLink>"<mt:If tag="CategoryDescription"> title="<mt:CategoryDescription remove_html="1" encode_html="1">"</mt:If>><mt:CategoryLabel> (<mt:CategoryCount>)</a>
<mt:Else>
<li><mt:CategoryLabel>
</mt:If>
</li>
</mt:Categories>
</ul>
And if you want to show the top categories and all their subcategories in a format which would allow you indend sub-categories, then use:
<mt:TopLevelCategories>
<mt:SubCatIsFirst>
<ul>
</mt:SubCatIsFirst>
<mt:If tag="CategoryCount">
<li><a href="<mt:CategoryArchiveLink>"<mt:If tag="CategoryDescription"> title="<mt:CategoryDescription remove_html="1" encode_html="1">"</mt:If>><mt:CategoryLabel> (<mt:CategoryCount>)</a>
<mt:Else>
<li><mt:CategoryLabel>
</mt:If>
<mt:SubCatsRecurse>
</li>
<mt:SubCatIsLast>
</ul>
</mt:SubCatIsLast>
</mt:TopLevelCategories>
Kind Regards,
Mihai Bocsaru
----------------------------------
Daily Movable Type Consultant
Web Development
Movable Type Consulting
Six Apart Partner
http://www.pro-it-service.com/
----------------------------------
Movable Type Demo
http://www.movabletypedemo.org/
----------------------------------
Open Melody Demo
http://www.openmelodydemo.org/
Hi Mihai
1) Thank you for that. Can you tell me where I put that code or do I create a widget for it and put that in the primary sidebar on the main website(which is where I would want it displayed).
2) Also, Mihai can you tell me how to have each entry that is displayed on the main (index) page to show the "Posted to [name of category/categories]" at the bottom of each entry?
Kind regards
Isaac Sarayiah
You're welcome!
1) You will have to put that code where you would like it to appear.
If it is inside the content column, then you should add it to the "Main Index" template.
If it is inside the sidebar, then it depends on your template set, which widget or module is the right one for it. A hint here is to first go to your "Main Index" template, then to look if it includes a module called "Sidebar" or "Footer" and to follow that path until you find the sidebar items and pick one where to put that logic.
Or create a new module or widget and add it to the sidebar...
2) You would first have to go to the "Main Index" template and see how it references the entries, probably it includes the "Entry Summary" template module.
Then go inside that place and use something like:
2.1) the following for calling the primary category only
"Posted to ">"
2.2) or the following for displaying all the categories assigned to that entry
"Posted to ">"
Enjoy,
Mihai
Hi Mihai
I can't get your code for displaying the categories on the main index page in the side bar to work. It doesn't display anything.
I created a new widget module and then saved that to the primary sidebar but once I've published it, nothing is dispalyed.