Help - Search - Members - Calendar
Full Version: Sorting Based On Custom Field?
Movable Type Community Forum > Using Movable Type > Entries and Archives
matrix_prime
Hello, I am VERY new to Movable Type, my work needed someone to support it, and my name was pulled out of the hat, lucky me.
The blogs we currently have setup were done by an outside company, so I'm still learning the Movable Type tags and how things work.

With that said, we were using version 3.x, but upgraded back in early August to 4.12 (I didn't do the upgrade, I wasn't assigned to work on it then) Anyways, we have some code in the template that was sorting entries based on a custom field. The code is

CODE
<MTEntries sort_by="CUSTOMFIELD:Faculty Spotlight Last Name" sort_order="ascend" lastn="2000">


This apparently worked in version 3.x that we were using, but no longer works in version 4.12. Could anyone shine any light on why this no longer works? Can you still sort on custom fields in 4.12? If so, why would this not be working? If I change sort_by to "title", it sorts the entries just fine based on the title of the entry, so sorting is working, just now on this custom field.
Thanks.
matrix_prime
nobody has done this or knows the answer to my question?
Chris J
Go into the settings for Custom Fields (in the Preferences drop-down menu) and find out what the basename is for the custom field you want to sort by. It's probably still "Faculty Spotlight Last Name", but this seems a little long, so just double check.

As far as I can work out, the code you want to use is:

CODE
<MTEntries sort_by="field:Faculty Spotlight Last Name" sort_order="ascend" lastn="2000">


If the basename isn't "Faculty Spotlight Last Name", then replace this part of the code with the actual basename.

This is the code that works in MovableType 4.2, which has Custom Fields built directly into it. I'm not sure if it'll work in 4.12, but it's certainly worth a try. If not, your best bet may be to upgrade to 4.2, which I have to say is an excellent version of the software.
OtherNiceMan
Sorting on custom fields is not possible in MT4.
caribou sue
QUOTE (OtherNiceMan @ Sep 5 2008, 02:14 PM) *
Sorting on custom fields is not possible in MT4.


Do we know if it will be? It would be really handy.
OtherNiceMan
You can now
CODE
<mt:Entries sort_by="field:customfieldbasename" sort_order="ascend|descend">


see notes on sort http://movabletype.org/documentation/appen...gs/entries.html
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.