Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-04-23 08:42:17

JeroenC
Member
From: Finland
Registered: 2010-04-14
Posts: 30
Website

if_category to show 1 or 2 categories

Hello all,

I like to show which categories I have assigned to an article and when I have 2 categories assigned I separate them with a + sign, this works. But when I only have 1 category assigned to an article I like the + sign not to be visible. I tried something with <txp:if_article… but never managed. Is there anybody who could help me out?

The example, see the extra “+” sign at “Blog entry4…”

My code:

<txp:category1 link="1" title="1" section="blog" this_section="1" /> + <txp:category2 link="1" title="1" section="blog" this_section="1" />

Many thanks already for any pointers :-)

Jeroen

Last edited by JeroenC (2010-04-23 08:43:14)


Time to volunteer? Come and join us at a great project which is going to be opensource: https://www.caloom.com

Offline

#2 2010-04-23 09:11:24

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

Re: if_category to show 1 or 2 categories

See if_article_category

<txp:if_article_category number="2">
	+
</txp:if_article_category>

And then just use number 1 as primary and 2 as secondary.

Offline

#3 2010-04-23 09:25:43

JeroenC
Member
From: Finland
Registered: 2010-04-14
Posts: 30
Website

Re: if_category to show 1 or 2 categories

:-D
It works!

Fantastic, many thanks

Jeroen


Time to volunteer? Come and join us at a great project which is going to be opensource: https://www.caloom.com

Offline

Board footer

Powered by FluxBB