Not a developer? Go to


Displaying Chronologically Threaded Comments

Chronological Threads display comments sorted by the date they were posted. If a comment was posted in reply to another, this information is shown inline rather than indenting the entire comment (thus creating a hierarchy).

The following sample code is from the MT 4.2 default templates. If you have customized your comment templates, these are bound to be different so you will have to adapt the logic.

  1. Open the template containing the code for displaying the comment detail. (In the MT4.0 default templates this is the Comment Detail template module, in MT4.2 it’s the Comments template module)
  2. The listing here is already a chronological listing of comments, we just need to determine if the comment has a comment it is in reply to and add a link to that parent comment. Find the code that is printing out the comment author’s name and replace it with the following:

        <!-- if this is a reply to another comment -->
        <span class="vcard author"><$MTCommentAuthorLink$></span> replied to <a href="<mt:CommentParent><$mt:CommentLink$></mt:CommentParent>">comment from <mt:CommentParent><$MTCommentAuthor$></mt:CommentParent></a>
        <!-- if this is an original/top-level comment -->
        <span class="vcard author"><$MTCommentAuthorLink$></span>

    The code above first determines if the comment has a parent. If so, then it produces a phrase with two links “ replied to ”. If the comment doesn’t have a parent comment then the code simply outputs the commenter’s name linked to their url.

  3. Republish your templates.

    Your comments should now be in a chronological thread and look something like this: