0

I have another post type which isn't the default one. I have four taxonomies attached to that post type. And I have many tags attached to these taxonomies.

I would like to create a drop down menu that pull automatically all the tags by their taxonomy.

For example: Post type: Culture Taxonomy 1: Books Under that, all the books (tags) Taxonomy 2: Movies Under that, all the movies (tags) etc..

Thanks!

2

wp_list_categories is what you're after. It takes taxonomy as an optional argument.

Example taken from Codex:

<?php 

$taxonomy     = 'genre';
$orderby      = 'name'; 
$show_count   = 0;      // 1 for yes, 0 for no
$pad_counts   = 0;      // 1 for yes, 0 for no
$hierarchical = 1;      // 1 for yes, 0 for no
$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>
| improve this answer | |
  • That's great. I changed it to wp_dropdown_categories to get a dropdown list. I have one problem. How do I link to each category like that? I want to choose something from that menu and be linked to the correspond page. – user1341839 Jul 10 '12 at 9:49

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.