Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
How to use exclude parameter in txp:article for excluding a category?
Since 4.6.0+ txp:article
seems to support excluding articles by their category, but it is not really clear for me, how to realize that.
exclude="article id(s) or field(s)" v4.6.0+
Exclude a specific article or list of articles (each ID separated by a comma), or the articles with matching fields (author, category, etc.).
So how can I exclude all articles with the first category “badcategory”?
Something like exclude="category=badcategory"
doesn’t work.
<txp:article exclude="category1=badcategory" wraptag="" break="" offset="0" limit="12" />
exclude="field(category1,badcategory)"
also doesn’t give the desired result.
Any hint?
Last edited by whocarez (2021-06-05 18:39:36)
Offline
Re: How to use exclude parameter in txp:article for excluding a category?
Untested but have you tried:
<txp:article exclude="category1" category1="badcategory" wraptag="" break="" offset="0" limit="12" />
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: How to use exclude parameter in txp:article for excluding a category?
Unfortunately, that doesn’t work. Excludes a lot of articles, but not the right ones. It seems to exclude all articles with an existing category1, means shows only noncategorised articles.
Last edited by whocarez (2021-06-05 19:03:16)
Offline
Re: How to use exclude parameter in txp:article for excluding a category?
How about
<txp:article exclude="category" category="badcategory" match="category1" />
Offline
Re: How to use exclude parameter in txp:article for excluding a category?
Sadly, it doesn’t work. To be sure, I try that in Textpattern 4.8.7 with PHP 8.0.5.
Offline
Re: How to use exclude parameter in txp:article for excluding a category?
It should probably be <txp:article_custom />
, since <txp:article />
ignores category
attribute.
Offline
Re: How to use exclude parameter in txp:article for excluding a category?
Should we accept section, category, etc
in <txp:article />
too, using URL context as defaults? Looks reasonable.
Offline
Re: How to use exclude parameter in txp:article for excluding a category?
Seems like a good idea. Maybe one day article_custom can be retired.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline