views:

14

answers:

1

Basically, I have created a custom post type and a custom taxonomy for that custom post. The custom taxonomy is hierarchical and the client plans on adding hundreds of categories. Because of this, they want the main page to display only the top level parent which is easy enough. However they want a drill down menu which only shows the parent and the children of the parent so they don't overwhelm the user. I think that what I basically need to do is get the parent id of the child so I can call up just those children.

I have been digging around and the code below is what I have come up with which I know if still far off from what it needs to be. Can you shed any light on this or at least give me a push in the right direction? I'm totally lossed.

I included the code below but I also put in pastebin at http://pastebin.com/B8qtz6Lf

<?php if (is_tax()) {
  $this_term = get_term();
  if (get_term_children($this_term->term_ID) != "") {
    echo "<h2>Subcategories</h2>";
    wp_list_categories( array (
        'title_li' => '',
        'depth' => '1',
        'child_of' => '.$this_term->term_ID'
    ));
  }
} else {
wp_list_categories( array(
        'taxonomy'      => 'compliance_categories',
        'title_li'      => '',
        'depth'         => '1'
        ));
}
?>

Any help you can give me would be awesome!

A: 

Not sure if this may help, but here is how I've been able to query a custom taxonomy within a custom post type. This may help you achieve what you're looking for.

$loop = new WP_Query(array('post_type' => 'products', 'product-type' => 'projectors'));
while ($loop->have_posts()) : $loop->the_post();

In this query, the custom post type is "products", the taxonomy is "product-type" and the category within that taxonomy is "projectors". This query will only show anything in the "projectors" category.

Hope that can give you some ideas to try.

cnix