tips and tricks for movable type

first entry in blog or category
February 15, 2003

Requires Brad Choate's MySQL plugin. He gets credit for the Category code via Brenna, who I believe first posted the Blog code in the forum.

First Entry in a Blog:

<MTSQLEntries query="SELECT entry_id, entry_created_on, entry_title, entry_blog_id FROM mt_entry WHERE entry_blog_id=2 ORDER BY entry_created_on ASC LIMIT 1">
<MTEntryDate>
<MTEntryTitle><br />
</MTSQLEntries>

First Entry in Each Category:

<MTCategories>
<$MTCategoryLabel$><br />
<MTSQLEntries query="select entry_id from mt_entry, mt_placement where placement_blog_id=[MTBlogID] and placement_category_id=[MTCategoryID] and entry_status=2 and entry_id=placement_entry_id order by entry_created_on asc limit 1">
<$MTEntryBody$>
</MTSQLEntries>
</MTCategories>

From this MT support forum thread.

Comments

the codes work great! thanks.

i was wondering how you would display the first entry of a category. i'm trying to create an index file that shoes only the first entries of all the categories.

by v | 04.09.03 10:02 AM

within a container tag, that is.

by v | 04.09.03 10:20 AM

Great site!
The help I get here and on scriptygoddess is awesome!

My other site:
CrimsonLight

by Jake | 04.19.03 10:56 PM

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)

TrackBack: 1
(URL: http://www.thegirliematters.com/sf/mt-track.cgi/139)

» Showing first entry in each category
Excerpt: As part of a new webpage based on MT, I needed to have the first entry in every category to be displayed, but no built in code in MT could do it. So I posted something on the MovableType forum...
Weblog: Nangka.org | Events
Tracked: 12.07.04 08:19 AM