Skip to content

Instantly share code, notes, and snippets.

@pablocattaneo
Last active September 16, 2017 00:15
Show Gist options
  • Save pablocattaneo/6efffbbe9760feaada48 to your computer and use it in GitHub Desktop.
Save pablocattaneo/6efffbbe9760feaada48 to your computer and use it in GitHub Desktop.
Returns subcategories (categories child) from a specific term.
<ul>
<?php
$categoryID = get_category_by_slug( 'blog' ); /*Retrieve category object by category slug*/
$categoryID = $categoryID ->term_id; /*Get the term id*/
$args = array(
'child_of' => $categoryID,
'title_li' => __( '' )
);
wp_list_categories( $args ); /*Display or retrieve the HTML list of categories.*/
?>
</ul>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment