Great work, thanks for sharing!
It could be useful use it with wp_list-categories. I have a hierarchical taxonomy and I want to expand only the parent term related to my search. For instance:
Term1
Term2
Term3
I click on Term2 and I get:
Term1
Term2
Sub-term1
Sub-term2
Sub-term3
Term3
This is the code I’m using on a page:
<?php
//list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)
$taxonomy = 'auto';
$orderby = 'name';
$show_count = 0; // 1 for yes, 0 for no
$pad_counts = 0; // 1 for yes, 0 for no
$hierarchical = 1; // 1 for yes, 0 for no
$title = '';
$args = array(
'taxonomy' => $taxonomy,
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title
);
?>
<ul>
<?php wp_list_categories( $args ); ?>
</ul>
Is there a simple way to do this?
Thanks,
E.