Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-11-26 06:30:27

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,258
Website GitHub Mastodon Twitter

[SOLVED] sort by custom field else...

This should be very simple but I am getting a tag error.

I would like to sort a particular category (list view) by custom field and the rest of the categories (list views) to have the normal Posted desc order.

This is what I have:

<txp:article limit="999" time="any" sort="alphabetize, Posted desc">

which the I understand it as: sort by custom field alphabetize or if alphabetize is not filled, use the Posted desc order. (I know that it actually means that if the custom field has the same value as another one, use the Posted desc order)

I am obviously wrong as I get an error

Tag error:  <txp:article limit="999" time="any" sort="alphabetize, Posted desc"> ->  Textpattern Warning: Unknown column 'alphabetize' in 'order clause'

Does anyone have any ideas why?

Edit: I also tried <txp:article limit="999" time="any" sort="alphabetize"> which produces the same error

Edit2: the page in question fails to load the article list but loads the rest of the template

Last edited by colak (2011-11-26 08:05:33)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Online

#2 2011-11-26 08:06:06

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 5,001
Website GitHub

Re: [SOLVED] sort by custom field else...

I think you will have to use the corresponding custom_# number for your sort attribute rather than its name, e.g. sort="custom_9 asc, Posted desc".

The sort will sort articles by the custom_field and any articles that share the same value for custom_field will be sorted by posted date. Articles without anything in the custom_field will be sorted by date but all together, e.g. as if “no-entry” was a letter of the alphabet.


TXP Builders – finely-crafted code, design and txp

Offline

#3 2011-11-26 08:19:22

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,258
Website GitHub Mastodon Twitter

Re: [SOLVED] sort by custom field else...

Hey Jakob, That was it. thanks!


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Online

Board footer

Powered by FluxBB