0

I want to list all parent, child, grandchild etc. taxonomies and the posts for those. Currently it lists all the taxonomies nicely indented in correct hierarchy but it shows no posts. Can you show posts using wp_list_categories() ?

This is what I have so far:

<?php

$taxonomy     = 'training-type';
$orderby      = 'name'; 
$show_count   = false;
$pad_counts   = false;
$hierarchical = true;
$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>

So the output would be something like:

-Clothing
   - Footwear
      - Socks
         - Red socks
         - Blue socks
         - Green socks

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.