Entry numbers in Movable Type

| No Comments | No TrackBacks |
Sometimes you may want to display a number along with your entry, to indicate how many entries have come before it for example.  There is no simple, built-in way to do this in Movable Type.  You could use the <mt:entryid> tag, but only if there is just a single blog in your system and you never delete an entry.  Because if you do there will be gaps in your order.  I recently had to display entry numbers on a multi-blog system where entries got deleted sometims.  Here is my solution.
I wrote a quick and dirty plugin called EntryNumber that adds two tags to Movable Type: <mt:entrycount> and <mt:entrycountreverse>.  Both tags require Entry context to work, so use them only inside an <mt:entries> loop or in an entry archive.

  • MTEntryCount: displays the number of entries that came before the current entry, plus one.  So the first entry in the blog is 1, the second is 2, the third one is 3 and so on.
  • MTEntryCountReverse: displays the number of entries that came after the current one, plus one.  So the most recent entry in the blog is 1, the second most recent is 2, the third most recent is 3 and so on.

The plugin can be downloaded for free: EntryNumber.zip

No TrackBacks

TrackBack URL: https://www.movabletips.com/cgi-bin/mt/mt-tb.cgi/11

Leave a comment