I’m not sure how i do this, i have set it up correctly in the back end so for example i have a category ‘bars and pubs’ and i have 3 other categories ‘x’ ‘y’ ‘z’ and all there parents are bars and pubs. I want to achieve something similar when i click on the parent category it will then show the child categories.
<div class=" cus-fw-tabs">
<ul>
<li><a href="#tabs-1">All</a></li>
<?php
$args = array(
'orderby' => 'ASC',
'order' => 'ASC',
'hide_empty' => false,
'exclude' => array(),
'exclude_tree' => array(),
'include' => $term_arr,
'number' => '',
'fields' => 'all',
'slug' => '',
'parent' => '',
'hierarchical' => true,
'child_of' => 0,
'childless' => false,
'get' => '',
'name__like' => '',
'description__like' => '',
'pad_counts' => false,
'offset' => '',
'search' => '',
'cache_domain' => 'core'
);
$terms = get_terms('category',$args);
if(!empty($terms)) {
$i=2;
foreach($terms as $term){
?>
<li class="tabs-<?php echo $term->term_id; ?>">
<a class="term-heading" href="#tabs-<?php echo $term->term_id; ?>"><?php echo $term->name; ?></a>
</li>
<?php
$i++;
}
}
?>
</ul>
</div>