MovableBlog: Plural Comments

Nuance 2.0

May 16, 2003

Jesper has developed MTPlural [more info] [MT support thread] which will not only add an 's' to the end of your, but allows for alternate comments link text depending on whether there are a) no comments; b) one comment; or c) multiple comments.

For those that think doing this dynamically is a better idea (and it's not), here's the PHP code I use at China Weblog:

<MTEntryIfAllowComments>
<p><a href="<$MTEntryPermalink$>#comments"><?php

if (<$MTEntryCommentCount$>) {
print("<$MTEntryCommentCount$> comment");
if (<$MTEntryCommentCount$> > 1) print ("s");
}
else {
print("Comment");
}

?></a></p></MTEntryIfAllowComments>

The plugin idea is a better one, since it cuts down on the processing the back-end needs to do each time a person visits your site.

Thanks to Paulo for the fodder heads-up.

Posted by Richard at 2:05