Forum
Display categories as individual sets
I'm having some confusion over how to display categories correctly. Have read all of the documentation and forum posts but nothing seems to quite explain it. I am trying to output my categories as a list except I want one set as the main list and two other sets within dropdown menus. I have everything working correctly to output all categories from all sets in a list but I can't work out how to separate them and select just the 'service' set for example.
I am using set="set name here(work or service)" within my categories template but it doesn't seem to make a difference.
This is my category template:
<perch:before>
<div class="filter layout">
<ul class="inline-list">
<li>Filter:</li>
<li><a href="/films-work">All</a></li>
</perch:before>
<li>
<a href="/films-work-category/<perch:category id="catPath" />">
<perch:category id="catTitle" type="smarttext" set="work" label="Title" required="true" />
</a>
</li>
<perch:after>
<li class="dropdown-tgl">
<a href="#" onclick="return false;">Service</a><i class="icon-keyboard_arrow_down" aria-label="Scroll down to see more"></i>
<ul class="dropdown">
<li>
<a href="#">
<perch:category id="catTitle" type="smarttext" set="service" label="Title" required="true" />
</a>
</li>
</ul>
</li>
</ul>
</div><!--/filter-->
</perch:after>
This is my .php page:
<div class="block--films block--films--work__list">
<?php
perch_categories(array(
'template' => 'films_work-filter.html',
));
perch_content_create('Work Examples', array(
'template' => 'films_work-detail.html',
'multiple' => true,
'edit-mode' => 'listdetail',
));
perch_content_custom('Work Examples', array(
'template'=>'films_work-listing.html'
));
?>
</div><!--/block-films-->
Any advice would be much appreciated!
Use the
set
option.https://docs.grabaperch.com/functions/categories/perch-categories/
Ah ok so you have to keep the markup outside of the template. Got it thank you.
.php page:
Work Filter template:
.htaccess: