Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2010-02-10 12:57:31

simoin
Member
From: Ireland
Registered: 2009-02-10
Posts: 50
Website

How to limit number of child categories when using category list

Hi I’m using the code below from from
TXP Tips to display a menu of sub categories.
It works great but I need to put a limit on amount of child categories shown.
Ideally I would show 3-4 sub categories and then a “view more” categories link.

I could use the exclude attribute but as it’s a business directory and there will be a lot of categories with sub-categories
it would be great if there was a better solution.

<txp:category_list parent="master-parent" exclude="master-parent" children="0" wraptag="ul" break="">
	<li class="cat"><txp:category title="1" />
	<txp:category_list parent='<txp:category />' exclude='<txp:category />' wraptag="ul" break="" class="subcat_list">
		<li><txp:category title="1" link="1" /></li>
	</txp:category_list>
	</li>
</txp:category_list>

Offline

Board footer

Powered by FluxBB