Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2015-12-05 06:43:38

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

[SOLVED] list articles by custom field

I am trying to parse a series of articles with the events staged in the NeMe Arts Centre. I have a custom field named venue and I am using the code below which for some reason it does not work.

A detail which may be important here is that the value in the CF is sometimes followed by a comma. ie NeMe Arts Centre,

<txp:article_custom limit="999" label="Previously at NAC" venue="NeMe Arts" section="events, participations" labeltag="h3" break="li" wraptag="ul" class="submenu">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>

Can anybody see what I might be doing wrong?


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

Offline

#2 2015-12-05 07:59:55

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,925
Website GitHub

Re: [SOLVED] list articles by custom field

I’m not sure that content fields do ‘contains’ statements.

And do you get matches if you use the exact wording, e.g. venue="NeMe Arts Centre"?

If you don’t have too many instances with the comma, you could clean those entries and add the comma via CSS using …:after { content: ", "; }.

Wasn’t there also a way of using % as a wild card for “zero or more”? Something like venue="NeMe Arts Centre%"


TXP Builders – finely-crafted code, design and txp

Offline

#3 2015-12-05 11:58:48

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

Re: [SOLVED] list articles by custom field

Thanks so much Julian,

The percentage symbol did it. Below is the final code and here it is the sidebar sub-menu in action.

<txp:article_custom limit="999" label="Previously at NAC" venue="NeMe Arts Centre%" section="events, participations" labeltag="h3" break="li" wraptag="ul" class="submenu">
<txp:permlink><txp:title /></txp:permlink>
</txp:article_custom>

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

Offline

Board footer

Powered by FluxBB