CatEntries
CatEntries, for including and excluding categories
Download CatEntries 3.0 (19 July 2004)
CatEntries displays entries including or excluding categories you specify. In addition to allowing you to exclude categories, CatEntries correctly displays N entries when given a lastn="N" attribute.
Changes since 2.5
3.0: Updated for Movable Type 3.0D.
2.8: Using offset with days works. If you specify both days and lastn, you get the last lastn entries in the specified days range.
2.7: Using days="3" on, say, 2 January didn't work. I thought it had been working across month boundaries, but apparently years gave it trouble.
2.6: Honors lastn and offset even on pages with natural entry contexts, like category pages.
Using CatEntries
To install, drop the above file as catentries.pl into your plugins directory, then modify your template to call it, e.g.:
<MTCatEntries lastn="4" exclude="Threads,Enjoying">
<i>your entry display code here</i>
</MTCatEntries>
This, for example, will show all entries that are not in the Threads or Enjoying categories, including entries in no categories. The options CatEntries supports are:
include="cat,cat,cat"- Show only entries from the given categories; entries posted to no categories will not be shown. Separate category names with commas.
exclude="cat,cat,cat"- Don't show any entries from the given categories. Excludes override includes, so
include="Cat" exclude="Mouse"will not show any entries posted to both Cat and Mouse. lastn="N"- Show the N most recently posted entries, as in
MTEntries. offset="N"- Make
lastnshow the most recent posts starting N posts ago, as inMTEntries. days="N"- Show the posts made during the last 24 × N hours, as in
MTEntries.
Future enhancements
- Recognize the empty string as the no-category category. (You can only include entries in no category by excluding all the other categories.)
- Honor
offsetwithday. Or not.
Hi Mark, thanks for this plugin. Any plans to add support for sort_order?
I don't really intend to update this plugin again. As you can see, I haven't touched it for almost two years now.
Supporting
sort_orderwould be a fairly simple change, though. I'd be happy to accept a patch from someone.Hi Mark - also just found this plugin. I know nothing about Perl, but am not scared to experiment with your plugin code to achieve my end: I need it to only display one entry (the latest one) per category, instead of all entries per category. If it is a simple change, could you direct me where to look/change? Thanks Simon
You don't need this plugin for that. This template code will work for a particular category:
<MTEntries lastn="1" category="categoryname"> ... </MTEntries>and this will give you a loop for all categories:
<MTCategories><MTEntries lastn="1"> ... </MTEntries></MTCategories>Hey there Mark, had a quick question. I'm using your <MTCatEntries> tag to exclude a catagory from the front page of my site, but I just changed the catagory name from one word, to two words, and I can't seem to get it to exclude the catagory now. Any suggestions?
As the plugin splits its list on commas, I don't know why it would fail to exclude a two-word category.
any suggestions for monthly archives? using catentries in monthly archives works great but it then ignores the date context (all months take the context of the first archive month loaded in the template ) many thanks.
Thanks for this plugin. but there are the problem when I try to work in <MTArchiveList>~</MTArchiveList>. As a detail "offset" & "lastn" don't work with this plugin.
Thanks for the plugin - works perfectly for what I needed!
Any word on whether this will work with MT4?
I don't know that it will, but you shouldn't need it, either. The syntax supported for
<MTEntries category="...">is more advanced even in 3.3 than when I wrote this plugin (3.0).As far as I can tell it works exactly the same in MT4.
They still don't have this functionality built in...
Well, what functionality do you mean? You can write
category="NOT Threads AND NOT Enjoying" lastn="4"and get the proper behavior.Awesome plugin, but konks out on Monthly Archives. (it skunks the date - so all entries show up, not just the month in questions)
Yup, that is true.
Oddly enough, this worked for me when I first upgraded to MT4. But today I had to re-install and it no longer loads. Very strange.