Im using taxonomies to create a custom side navigation which has 2 levels.
I was pulling out the entire list of taxonomies and using the nesting to create the relevant ordered lists.
as follows :
<?php
$taxonomy = 'work_categories';
$orderby = 'name';
$show_count = 0;
$pad_counts = 0;
$hierarchical = 1;
$title = '';
$args = array(
'taxonomy' => $taxonomy,
'orderby' => $orderby,
'show_count' => $show_count,
'pad_counts' => $pad_counts,
'hierarchical' => $hierarchical,
'title_li' => $title,
'exclude' => '28'
);
?>
<ul>
<?php wp_list_categories( $args ); ?>
</ul>
which is outputting
<ul>
<li><a href=">Top level tax</a>
<ul>
<li><a href=">second level tax</a></li>
<li><a href=">second level tax</a></li>
<li><a href=">second level tax</a></li>
</ul>
</li>
<li><a href=">Top level tax</a>
<ul>
<li><a href=">second level tax</a></li>
<li><a href=">second level tax</a></li>
<li><a href=">second level tax</a></li>
</ul>
</li>
...
</ul>
However I dont want the 1st level to be links. I have looked at doing a custom output using something like this :
$terms = get_terms("work_categories");
$count = count($terms);
if ( $count > 0 ){
echo "<ul>";
foreach ( $terms as $term ) {
echo "<li>" . $term->name . "</li>";
}
echo "</ul>";
}
echo "<pre>";
print_r( $terms);
echo "</pre>";
But i found the logic to be really confusing...
is there an easy way to achieve the following :
<ul>
<li>Top level tax //NO LINK
<ul>
<li><a href=">second level tax</a></li>
<li><a href=">second level tax</a></li>
<li><a href=">second level tax</a></li>
</ul>
</li>
<li>Top level tax //NO LINK
<ul>
<li><a href=">second level tax</a></li>
<li><a href=">second level tax</a></li>
<li><a href=">second level tax</a></li>
</ul>
</li>
...
</ul>