If you are using a hierarchical taxonomy (one that supports child terms), you may need to query its children. Zack Pyle has a nice code snippet to make it easier, but the vanilla way is to pass the parent ID to the child taxonomy query. In its simplest form, it looks like this
<?php
$query_args = [
'taxonomy' => 'category',
'parent' => $parent_id
];The loop would look like this
{#loop childTax($parent_id:term.id) as item}
<p>{item.name}</p>
{/loop}You can use this on a taxonomy archive page or as a nested loop within a parent taxonomy loop. I used this approach on the Articles archive template for the facet filters.
Leave a Reply