Wordpress: List sub-categories of current category


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



Copy this code and paste it in your HTML
  1. <?php if (is_category()) {
  2. $current_cat = get_category($cat);
  3. if (get_category_children($current_cat->cat_ID) != "") {
  4. echo "<ul>";
  5. wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$current_cat->cat_ID);
  6. echo "</ul>";
  7. }
  8. } ?>

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.