Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Show only Categories 'used'
Hi, I want to show only Categories that are currently used. I mean, Categories that have, at least, 1 article (Inside them)
I hope you understand me.
Thanks in advance.
Offline
#2 2009-02-05 00:10:12
- els
- Moderator
- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: Show only Categories 'used'
I did it like this:
<txp:category_list wraptag="ul" break="">
<txp:variable name="hasarticle" value='<txp:article_custom category=''<txp:category />'' limit="1" />' />
<txp:if_variable name="hasarticle" value="">
<txp:else />
<li><txp:category title="1" link="1" class='<txp:if_category name=''<txp:category />''>current</txp:if_category>' /></li>
</txp:if_variable>
</txp:category_list>
Offline
Re: Show only Categories 'used'
OMG Els, you rules! It’s exactly what I wanted. Thank you very much. God bless you!
Offline
Pages: 1