Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
#1 2009-04-30 14:48:50
- Gulfcoast
- Member
- Registered: 2009-04-12
- Posts: 76
Category Exclusion
I have posted an article to be sticky on the default page:
<txp:article_custom status=“sticky” id=“3” />
<txp:article limit=10 />
It is fine except it is also showing up on category pages as well.
I’m trying to figure out the correct tag to exclude it from the categories: business and grace.
Would I due an exclusion tag to do this such as:
<txp:if_category=“business,grace”>
<txp:article form=“default” section=“article” limit=“10” />
<txp:else />
<txp:article_custom status=“sticky” id=“3” />
<txp:article limit=10 />
</txp:if_category=“business,grace”>
Thank you very much.
Offline
Re: Category Exclusion
Using status="sticky"
as an attribute to article_custom
doesn’t make the article sticky — it’s for limiting results to articles with that status. It is, I think, redundant to have both status="sticky"
and id="3"
. Have you assigned article #3 sticky status? It sounds as though you haven’t. Do that, then your article_custom
tag only needs id="3"
. (If #3 is your only sticky article, it would also work using only status="sticky"
.)
Code is topiary
Offline
#3 2009-04-30 16:03:31
- Gulfcoast
- Member
- Registered: 2009-04-12
- Posts: 76
Re: Category Exclusion
Thank you for your reply J Soo. I had indicated the article to be sticky and have since dropped the id=“3”. Is the additional code a valid way to accomplish my objective? Thank you kindly.
Offline
#4 2009-04-30 16:33:01
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Category Exclusion
A couple of changes to your code:
<txp:if_category name="business,grace">
<txp:article />
<txp:else />
<txp:article_custom status="sticky" id="3" />
<txp:article />
</txp:if_category>
- you need the
name
attribute in the if_category tag. - The
<txp:article />
tag doesn’t have an attributesection
. It doesn’t need it anyway, because the tag is context sensitive, meaning that it will only return articles from the section/category that is currently being viewed. - ‘default’ is the default value for attribute
form
, so you don’t need it. - ‘10’ is the default value for attribute
limit
, so you don’t need it. - don’t use attributes in closing (if_category) tags.
This code will do the same:
<txp:if_category name="business,grace">
<txp:else />
<txp:article_custom status="sticky" id="3" />
</txp:if_category>
<txp:article />
Note that this code will only exclude the sticky article on your category pages for ‘business’ and ‘grace’. If you want to exclude it on all category pages, just use <txp:if_category>
(without the name
attribute), it means ‘if on any category page’.
Offline
#5 2009-04-30 16:52:49
- Gulfcoast
- Member
- Registered: 2009-04-12
- Posts: 76
Re: Category Exclusion
Got it Els. You are a God send. I’m learning, slowly but surely.
Offline
Pages: 1