List Wordpress Custom Taxonomies


/ Published in: PHP
Save to your folder(s)

Found on the wordpress.org forums, courtesy of snails07


Copy this code and paste it in your HTML
  1. //list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin)
  2.  
  3. $taxonomy = 'eventcategory';
  4. $orderby = 'name';
  5. $show_count = 0; // 1 for yes, 0 for no
  6. $pad_counts = 0; // 1 for yes, 0 for no
  7. $hierarchical = 1; // 1 for yes, 0 for no
  8. $title = '';
  9. $empty = 0;
  10.  
  11. $args = array(
  12. 'taxonomy' => $taxonomy,
  13. 'orderby' => $orderby,
  14. 'show_count' => $show_count,
  15. 'pad_counts' => $pad_counts,
  16. 'hierarchical' => $hierarchical,
  17. 'title_li' => $title,
  18. 'hide_empty' => $empty
  19. );
  20.  
  21. <ul>
  22. <?php wp_list_categories( $args ); ?>
  23. </ul>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.