Sorting Categories in MT: A Fourth Solution
plugin | 20 December 2010 |
I had some trouble with it in an earlier version, but a later version (1.02) works beautifully on the MT4.x platform.
Note that the latest version, 1.11, does not seem to work correctly in MT4.x, though it works in MT5. See Karina’s comment here.
Pretty simple, like every other plugin. The zipfile has two folders, mt-static and plugins. Copy them to the correct folders in your MT install, and you’re good to go. The system will then do its upgrade number.
Once installed correctly, go to the Plugins section of the blog in which you want to sort the folders or categories. Click on settings and use the nifty arrows to move your categories/folders up and down.
Change to your template. For the plugin to work, you must add this attribute to your category block tag in your template: sort_method=”SortCatFld::Sort”
Your template code should then read like so:
<mt:SubCategories sort_method="SortCatFld::Sort"> <-- do something --> </mt:SubCategories>
The reason is that specialized block tag <MT:SubCategories> has an advanced usage attribute, viz.,
sort_method, and this expects “a fully qualified Perl method name to be used to sort the categories”.
You can see it at work in the sidebar at Prisoner of Agenda. There, clippings and stuff from other sources, all in the “Others” primary category, are listed by sub-category in a sequence I have defined with the plugin. That way, the subcategory Voices of Sanity lists above the subcategory News. Without the plugin, it would all be alphabetical.