<mt:Entries>
The Entries tag is a workhorse of MT publishing. It is used for publishing a selection of entries in a variety of situations. Typically, the basic use (specified without any attributes) outputs the selection of entries that are appropriate for the page being published. But you can use this tag for publishing custom modules, index templates and widgets to select content in many different ways.
Attributes:
- lastn (optional)
Allows you to limit the number of entries output. This attribute always implies selection of entries based on their 'authored' date, in reverse chronological order.
<mt:Entries lastn="5" sort_by="title" sort_order="ascend">
This would publish the 5 most recent entries, ordered by their titles.
- limit (optional)
Similar to the
lastnattribute, but limits output based on whichever sort order is in use. - sort_by (optional; default "authored_on")
Accepted values are:
authored_on,title,ping_count,comment_count,author_id,excerpt,status,created_on,modified_on,rate,score(bothrateandscorerequire anamespaceattribute to be present).If you have the Professional Pack installed, with custom fields, you may specify a custom field basename to sort the listing, by giving a
sort_byvalue offield:basename(where 'basename' is the custom field basename you wish to sort on). - sort_order (optional)
Accepted values are 'ascend' and 'descend'. The default is the order specified for publishing entries, set on the blog entry preferences screen.
- field:basename
Permits filtering entries based on a custom field defined (available when the Commercial Pack is installed).
Example:
<mt:Entries field:special="1" sort_by="authored_on" sort_order="descend" limit="5">This selects the last 5 entries that have a "special" custom field (checkbox field) checked.
- namespace (optional)
The namespace attribute is used to specify which scoring namespace to use when applying the
sort_by="score"attribute, or filtering based on scoring (any of themin_*,max_*attributes require this).The MT Community Pack provides a 'community_pack_recommend' namespace, for instance, which can be used to select entries, sorting by number of recommend/favorite votes that have been made.
- class_type (optional; default 'entry')
Accepted values are 'entry' and 'page'.
- offset (optional)
Accepted values are any non-zero positive integers, or the keyword "auto" which is used under dynamic publishing to automatically determine the offset based on the
offsetquery parameter for the request. - category or categories (optional)
This attribute allows you to filter the entries based on category assignment. The simple case is to filter for a single category, where the full category name is specified:
<mt:Entries category="Featured">
If you have multiple categories with the same name, you can give their parent category names to be more explicit:
<mt:Entries category="News/Featured">
or
<mt:Entries category="Projects/Featured">
You can also use 'AND', 'OR' and 'NOT' operators to include or exclude categories:
<mt:Entries categories="(Family OR Pets) AND Featured">
or
<mt:Entries categories="NOT Family">
- include_subcategories (optional)
If this attribute is specified in conjunction with the category (or categories) attribute, it will cause any entries assigned to subcategories of the identified category/categories to be included as well.
- tag or tags (optional)
This attribute functions similarly to the
categoryattribute, but filters based on tag assignments. It also supports the logical operators described for category selection. - author (optional)
Accepts an author's username to filter entry selection.
Example:
<mt:Entries author="Melody">
- id (optional)
If specified, selects a single entry matching the given entry ID.
<mt:Entries id="10">
- min_score (optional)
- max_score (optional)
- min_rate (optional)
- max_rate (optional)
- min_count (optional)
- max_count (optional)
Allows filtering of entries based on score, rating or count. Each of the attributes require the
namespaceattribute. - scored_by (optional)
Allows filtering of entries that were scored by a particular user, specified by username. Requires the
namespaceattribute. - days (optional)
Limits the selection of entries to a specified number of days, based on the current date. For instance, if you specify:
<mt:Entries days="10">
only entries that were authored within the last 10 days will be published.
- recently_commented_on (optional)
Selects the list of entries that have received published comments recently. The value of this attribute is the number of days to use to limit the selection. For instance:
<mt:Entries recently_commented_on="10">
will select entries that received published comments within the last 10 days. The order of the entries is the date of the most recently received comment.
- unique
If specified, this flag will cause MT to keep track of which entries are being published for a given page. It will also prevent the publishing of entries already published.
For example, if you wish to publish the last 3 entries that are tagged "@featured", but wish to exclude these entries from the set of entries that follow, you can do this:
<mt:Entries tag="@featured" lastn="3"> ... </mt:Entries> <mt:Entries lastn="7" unique="1"> ... </mt:Entries>The second Entries tag will exclude any entries that were output from the first Entries tag.
- glue (optional)
Specifies a string that is output inbetween published entries.
Example:
<mt:Entries glue=","><$mt:EntryID$></mt:Entries>
outputs something like this:
10,9,8,7,6,5,4,3,2,1

moonpost
September 13, 2007 9:43 AM | Reply
Apparently there is a value that goes along with the "unique" filter. I couldn't find docs so I just guessed and if you use: unique="true" it will filter out entries already published elsewhere on the same page. Does anybody know the full info on this filter?
Byrne Reese
September 14, 2007 9:53 AM | Reply
@moonpost - The value for the unique attribute should be either "1" or "0". If the tag is not functioning the way you expect, please let us know.
Jay Allen
November 1, 2007 5:28 PM | Reply
Important note: This tag supports all of the MultiBlog template tag attributes
blog_ids/include_blogsandexclude_blogsfor aggregating across different blogs.Aryo Sanjaya
January 3, 2008 10:52 PM | Reply
For the sorting attribute, what is the 'score' mean?
If I want to show entries with most commented order, what attributes I should be use?
Thank you.
Solomon
February 1, 2008 5:26 PM | Reply
Would be nice if you could use "offset" in coordination with "days" in addition to lastn.
Maurice
February 8, 2008 11:30 AM | Reply
Two comments:
1) Typo in the "offset" description: "M entries" should be "N entries". (now fixed)
2) It would be useful to have "days" combined with something like "lastn" for situations where you want to highlight a recent entry, but not if it is more than x days old. If you have an alternative for such a situation, I would love to know. Thanks.
Aryo Sanjaya
February 12, 2008 10:26 PM | Reply
@Solomon and Maurice:
No, those attributes are to show the most recently entries.
What I want is to show the most commented entries, for example to show the entries like:
Or maybe I have to find a plugin for this? or just to use this tag? but how.
Thank you for your answer anyway.
Aryo Sanjaya
February 24, 2008 9:50 AM | Reply
Ok guys, I just got the answer here:
http://www.fakejazz.com/fake/archives/2005/02/movabletypepl.php
Maarten Schenk
May 19, 2008 6:40 AM | Reply
Correct URL: http://www.fakejazz.com/fake/archives/2005/02/movable_type_pl.php
http://openid.aol.com/studiolift
July 25, 2008 3:57 AM | Reply
This page obviously changed overnight (customfield sorting! woot!!).
Someone has removed the following:
In the event that you have two categories that have the same name that you wish to filter by, you can also specify category IDs in your logical expression, provided that the category ID is preceded by a pound ("#") sign.
Has this feature gone?
Rob Kenny
August 28, 2008 12:30 PM | Reply
auto for the Offset is case sensitive. offset="Auto" throws error, offset="auto" does not.
JonathanS
September 1, 2008 6:17 AM | Reply
Filtering on custom fields didn't behave quite how I expected from the above write-up. For example
<mt:Var ... >doesn't seem to be evaluated in an<mt:Entries ...>block. Thus:...doesn't work. The alternative syntax
$name, however, does work:More about this at in the forumshere.