i'm trying create following menu structure custom taxonomies:
cat 1 -subcat1 -subcat2 cat 2 cat 3 cat 4 what want achieve when click on child category (subcat1 example) current navigation structure should stay same, , bold current subcat. when click on parent category, it's subcategories should appear , the rest of parent cats (not cats subcats).
my problems following:
i managed create child navigation menu when clicking on parent category, shows current , child level categories in menu, without other main categories using code:
<?php $taxonomy = $tax; $orderby = 'name'; $show_count = 1; // 1 yes, 0 no $pad_counts = 0; // 1 yes, 0 no $hierarchical = 1; // 1 yes, 0 no $title = ''; if (get_term_children($term->term_id, $tax) != null) { $child = $term->term_id; } else { $child = ''; } $args = array( 'taxonomy' => $taxonomy, 'orderby' => $orderby, 'show_count' => $show_count, 'pad_counts' => $pad_counts, 'hierarchical' => $hierarchical, 'title_li' => $title, 'child_of' => $child, 'current_category' => 0 ); ?> <? if (get_term_children($term->term_id, $tax) != null) { ?> <h3><?php echo $term->name; ?> templates</h3> <? } ?> <?php wp_list_categories( $args ); ?> the problem above code when click on child category parent/subcategories displayed again.
i want able stay on same structure when browsing of subcategories 1 big category addition of bold font face subcategory i'm browsing.
if makes sense please help.
thanks,
what create custom query loop through taxonomy parent of 0 in loop of displaying them get_term_children function. believe best way create this. have done in plugin , has allowed me have more customisation.
Comments
Post a Comment