Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2008-04-05 06:22:23

NickCaldwell
Member
From: Brisbane, Queensland in AU
Registered: 2004-03-04
Posts: 40
Website

Exclude a category from txp:article

Or txp:custom_article for that matter. I’ve been trying a few different ways to simply output a sidebar with short articles in a “quick links” category. The best technique seems to be txp:article_custom category=“quick-links”, etc. But now I’m just puzzling how to exclude these articles from the home page main article listing. This is quite trivial (if unaesthetic) to do in Wordpress so I thought it’d be a doddle with Textpattern — particularly given how hard it is to output multiple ‘loops’ on the one page with Wordpress. But there doesn’t seem to be any exclusion facility in the default tags.

I guess some kind of conditional might do the trick? I’m not keen on a plugin, as I’m using a fair number already. What am I missing?

Offline

#2 2008-04-05 08:12:32

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Exclude a category from txp:article

You could assign the ‘quick links’ articles to a section of their own, and set that section to not be displayed on the front page. Use <txp:article_custom /> to call them in the sidebar.
Alternatively, you could use a conditional in your article form for the front page articles:

<txp:if_article_category name="quick-links">
<!-- do nothing -->
<txp:else />
here the content of your article form
</txp:if_article_category>

Offline

#3 2008-04-05 08:35:07

NickCaldwell
Member
From: Brisbane, Queensland in AU
Registered: 2004-03-04
Posts: 40
Website

Re: Exclude a category from txp:article

Ah, that might do the trick. Thanks.

Anyone know if exclusions are on the horizon? They’re pretty handy to have.

Offline

#4 2008-04-05 22:43:07

Fontanel
Member
Registered: 2006-02-08
Posts: 15
Website

Re: Exclude a category from txp:article

Instead if excluding, you could only include the categories you want. Although I agree that an exclude tag would come in handy

Offline

#5 2008-04-05 22:55:53

Gocom
Developer Emeritus
From: Helsinki, Finland
Registered: 2006-07-14
Posts: 4,533
Website

Re: Exclude a category from txp:article

Instead if excluding, you could only include the categories you want

Sometimes there is just too many categories to be included, and sometimes categories are changed too many times or added too frequently :)

Offline

#6 2008-04-05 23:01:48

Fontanel
Member
Registered: 2006-02-08
Posts: 15
Website

Re: Exclude a category from txp:article

I agree, and thats why an exclude=“comma seperated list” would come in handy ;)

Offline

#7 2008-04-05 23:13:03

ruud
Developer Emeritus
From: a galaxy far far away
Registered: 2006-06-04
Posts: 5,068
Website

Re: Exclude a category from txp:article

This is where an where attribute comes in handy, where you can add something to the where part of the SQL query, otherwise we’d get exclude_section, exclude_category, exclude_author, exclude_id, exclude_something_else and the list of attributes explodes.

Offline

#8 2008-04-06 03:23:16

Logoleptic
Plugin Author
From: Kansas, USA
Registered: 2004-02-29
Posts: 482

Re: Exclude a category from txp:article

There may be a plugin that offers selective category exclusion. I could swear I’ve seen such a thing on Textpattern Resources.

Offline

#9 2008-04-06 07:10:11

NickCaldwell
Member
From: Brisbane, Queensland in AU
Registered: 2004-03-04
Posts: 40
Website

Re: Exclude a category from txp:article

I had a skim through the Category category on Textpattern resources but didn’t come up with anything. I do find sometimes that new plugins aren’t always immediately categorised correctly there, though.

Offline

Board footer

Powered by FluxBB