Forum
perch_categories subcategory title?
Quesiton
How do I display a subcategory title?
perch_categories
The code below displays the catTitle
for top level categories. It doesn't work for subcategories?
perch_categories([
'set' => 'faqs',
'template' => 'category--faq-desc.html',
'filter' => 'catSlug',
'match' => 'eq',
'value' => perch_get('cat'),
]);
Routes
debug
shows me my route is matched
Matched route: faqs/[slug:cat]/[slug:subcat]
perch:showall
This table shows I'm viewing the balance
subcategory, but the catTitle
displays the parent category, Exercises
. How do I display
the subcategory title?
<perch:showall />
table for my template category--faq-desc.html
Template: category--faq-desc.html
<perch:before>
<div>
</perch:before>
<h1><perch:category id="catTitle" type="smarttext" label="Title" required="true" /></h1>
<perch:category id="catSlug" type="slug" for="catTitle" suppress="true" />
<perch:after>
</div>
</perch:after>
I came up with a solution. Sometimes it helps to write out the problem.