redneckrobot

Show only the selected subcategory for an entry

Vote 0 Votes

In MT 4.3 I'm trying to set-up a simple if/else loop to allow for a replacement of the Author Display Name with a Sub Category name.

The code I currently have written displays all the SubCategories for the ParentCategory (which is 'Guest contributors'):



" rel="category">





">




Here's the question I can't seem to solve: How do you show only the selected SubCategories? Right now, the code I'm working with shows all the SubCategories (whether they are selected or not).

Many many thanks for any insights into this. I've searched the forum but have not uncovered any nuggets of wisdom on this bit ...

Reported on Movable Type 4.3

3 Replies

| Add a Reply
  • redneckrobot

    Woops! Here's the template code for the previous question:

    <mt:if tag="EntryCategory" eq="Guest contributors">
    <mt:SubCategories category="Guest contributors">
    <a href="<$MTCategoryArchiveLink$>" rel="category">
    <$MTCategoryLabel$>
    </a>
    </mt:SubCategories>
    <mt:Else>
    <span class="author vcard">
    <a href="<$mt:EntryLink type="Author"$>">
    <$mt:EntryAuthorDisplayName$>
    </a>
    </span>
    </mt:If>

  • What do you understand by "selected subcategories"?

    On which page types are you using this coding and what is your goal? What exact do you expect to obtain?

    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/

  • redneckrobot

    Thanks for the response Mihai (appreciate it). Let me rephrase my question: How do you show a list of the assigned subcategories for an entry?

    Using the default 'posted by' code, all assigned categories are returned. Is there a way to only show subs?

    Example I'm using:

    <MTIfNonEmpty tag="EntryCategory"><span class="categories"><span class="text">Posted in</span> <MTEntryCategories glue=', '><a href="<$MTCategoryArchiveLink$>" rel="category"><$MTCategoryLabel$></a></MTEntryCategories></span></MTIfNonEmpty>
                      
                      
    

Add a Reply

If you need to share template code, replace all the "<" signs with "&lt;" or use this utility.

Forum Groups

1774 6167

Last Topic: Template modules by Zielun on Feb 16, 2012

86 302

Last Topic: website entries by masoud on Oct 26, 2011

1434 5088

Last Topic: Maintenance announcement by Nick on Feb 17, 2012

695 2912

Last Topic: Insert Image / File Fails by Russ Miller on Feb 10, 2012

84 291

Last Topic: How to have some other characters in entry basename automatically written by Afshin Haghighatnia on Dec 22, 2011

174 740

Last Topic: Captcha images rendering slowly by ScottM on Feb 12, 2012

190 568

Last Topic: Analytics Reporting by michael webster on Feb 5, 2012

48 210

Last Topic: An idea and also a request by Afshin Haghighatnia on Jun 29, 2011

64 246

Last Topic: jQuery in MT 5.1 still at 1.4 - why? by perlmonkey on May 25, 2011

code.sixapart.com

137 478

Last Topic: Getting a thumbnail with xpath by Peter on Mar 13, 2011

222 720

Last Topic: Custom Field for Asset Not Appearing by android on Feb 9, 2012