0

In a wordpress project i made a post type named 'product' and registered the texonomies named 'product_category' which is heirerchical. i added four catagories in the admin panel, those are 'oven','Nit','Textile','Garments'. Under each of these i added two more taxnomies call 'pant','shirt', again each of these two i wanted to add more three categories named 'man','woman','children'... Above all the structure i expected is,

Oven

-Pant

 -Man
 -Woman
 -children

-Shirt

 -Man
 -Woman
 -children

Nit

-Pant

 -Man
 -Woman
 -children

-Shirt

 -Man
 -Woman
 -children

Textile

->Pant

 ->Man
 ->Woman
 ->children

->Shirt

 ->Man
 ->Woman
 ->children

Garments

->Pant

 ->Man
 ->Woman
 ->children

->Shirt

 ->Man
 ->Woman
 ->children

And in the front end i want to show these just as the structure above, how can i show these taxonomies like this so that clicking the last level taxonomy, the realated posts will be displayed and for this how i should make the taxonomies? Thank You.

Mithu A Quayium
  • 729
  • 5
  • 14

1 Answers1

1

you need to edit your theme file. for instance, if you use "twenty-twelve" theme, add in "content.php" the following just after line <div class="entry-content">

<ul class="entry-taxonomies">
  <?php // taxonomies
  $id = get_the_ID();
  foreach ( get_object_taxonomies( 'post' ) as $taxonomy ) {
    $terms_list = get_the_term_list( $id, $taxonomy, '<ul class="tax-terms"><li>', '<span class="tax-sep">'.__( ', ', 'twentytwelve' ).'</span></li><li>','</li></ul>' );
    if ( $terms_list ) {?>                  
     <li><span class="tax-taxonomy"><?php echo $taxonomy; ?></span><?php echo $terms_list; ?></li><?php
    }
  }?>
  </ul>

more information: http://wp.tutsplus.com/tutorials/plugins/a-guide-to-wordpress-custom-post-types-taxonomies-admin-columns-filters-and-archives/

hope this helps. B.

Berteh
  • 73
  • 8