Skip to content

Instantly share code, notes, and snippets.

@bologer
Last active August 29, 2015 14:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bologer/6893c470b3fb86b6b030 to your computer and use it in GitHub Desktop.
Save bologer/6893c470b3fb86b6b030 to your computer and use it in GitHub Desktop.
Wordpress вывод категорий
<?php
if (is_category()):
$this_category = get_category($cat);
endif;
?>
<?php
if($this_category->category_parent):
$this_category = wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->category_parent."&echo=0");
else:
$this_category = wp_list_categories('orderby=id&show_count=0&title_li=&use_desc_for_title=1&child_of='.$this_category->cat_ID."&echo=0");
endif;
if ($this_category): ?>
<ul>
<?php echo $this_category; ?>
</ul>
<?php endif; ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment