Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2011-08-13 03:53:42

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Listing articles using custom fields as a sort method

I’m looking for a way to do something like a repeating section_list >> article_custom hierarchy, but using a custom field instead of a section.

Where I run into trouble is with <article_custom fruit="strawberries" /> which seems to make the universe fold in on itself sometimes. For example, it doesn’t seem to like spaces in the custom field value. It also rejects my use of dashes in the custom field name.

Any tips?

Result should look like:

Custom Field 1 = Strawberries

  • Article 1 (CF1 = Strawberries)
  • Article 2 (CF1 = Strawberries)

Custom Field 1 = Watermelon

  • Article 34 (CF1 = Watermelon)
  • Article 22 (CF1 = Watermelon)

Last edited by maruchan (2011-08-13 04:00:56)

Offline

#2 2011-08-13 03:59:13

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Re: Listing articles using custom fields as a sort method

Current broken example:

 <h1>Sister Sites</h1>
<txp:article_custom linktype="sister-sites" section="local-links" />

This shows zero results, even though there are articles in the local-links section with linktype set to sister-sites.

Last edited by maruchan (2011-08-13 03:59:46)

Offline

#3 2011-08-13 04:06:12

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

Re: Listing articles using custom fields as a sort method

Hi Marc,

I think that it was Ruud who mentioned about the naming of custom fields somewhere in this forum.

Spaces dashes slashes etc are not advised (someone correct me if I am wrong here).

I would change the dash to an underscore.

Also I’m not sure if linktype is supported for article_custom

Last edited by colak (2011-08-13 04:08:07)


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

Offline

#4 2011-08-13 04:20:35

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Re: Listing articles using custom fields as a sort method

Is “linktype” reserved? I’m just using it as the customfieldname=“value” pair allowed as per the article_custom documentation.

I’ll try underscores in the values though…thanks Yiannis.

Last edited by maruchan (2011-08-13 04:20:52)

Offline

#5 2011-08-13 04:28:01

maruchan
Member
From: Ukiah, California
Registered: 2010-06-12
Posts: 596
Website

Re: Listing articles using custom fields as a sort method

OK, wow. This worked — I just replaced dashes with underscores:

<txp:article_custom link_type="sister_sites" section="local-links" />

That’s a big relief. Thanks for the tip, Yiannis!

Made use of my shiny new Wiki editing account to update the documentation…

Offline

#6 2011-08-13 10:01:49

redbot
Plugin Author
Registered: 2006-02-14
Posts: 1,410

Re: Listing articles using custom fields as a sort method

maruchan wrote:

…For example, it doesn’t seem to like spaces in the custom field value.

colak wrote:

…I think that it was Ruud who mentioned about the naming of custom fields somewhere in this forum

See here

Offline

Board footer

Powered by FluxBB