Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#1 2007-06-02 19:48:04
- Logoleptic
- Plugin Author
- From: Kansas, USA
- Registered: 2004-02-29
- Posts: 482
Sorting by custom fields: 10 before 2?
I’m wanting to sort articles by a custom field, but I have a quick question: does the sort get handled alphabetically, so that 10 comes before 2? I just need to know if I should start out using 2-digit numbers to avoid problems.
I’m sure I’ve seen this discussed elsewhere, but searching the forum hasn’t turned up anything useful. Thanks in advance!
Offline
#2 2007-06-02 20:07:15
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Sorting by custom fields: 10 before 2?
The sorting is alphabetically. If I’m not mistaken, there is a plugin though that can change this to numeric. Just can’t remember what it’s called…
Offline
#3 2007-06-02 20:22:40
- FireFusion
- Member
- Registered: 2005-05-10
- Posts: 698
Re: Sorting by custom fields: 10 before 2?
No need for plugins. This is all you need
sort="(custom_2+0)"
replace custom_2 with the number of your field.
E.g.
<txp:article_custom sort="(custom_2+0)" category="events" form="li_sub_nav" offset="1" />
Offline
#4 2007-06-02 21:46:17
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Sorting by custom fields: 10 before 2?
Hey, didn’t know that… Thanks!
Offline
#5 2007-06-02 23:24:05
- Logoleptic
- Plugin Author
- From: Kansas, USA
- Registered: 2004-02-29
- Posts: 482
Re: Sorting by custom fields: 10 before 2?
Thanks, Robin!
Offline
#6 2009-08-24 03:24:09
- kevinpotts
- Member
- From: Ghost Coast
- Registered: 2004-12-07
- Posts: 370
Re: Sorting by custom fields: 10 before 2?
I just want to say thanks to FireFusion two years later for that snappy tip on numeric sorting. Just saved my ass. This forum is awesome.
Kevin
(graphicpush)
Offline