Created
August 17, 2016 02:53
-
-
Save ramiabraham/48700f558ae2eac325312b809ca2d4c8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$categories = get_categories( array( | |
'orderby' => 'name', | |
'parent' => 0, | |
'post_type' => 'orange_cats' | |
) ); | |
echo 'Shows all taxonomies for the given post type:'; | |
echo '<br />'; | |
foreach ( $categories as $category ) { | |
printf( '<a href="%1$s">%2$s</a><br />', | |
esc_url( get_category_link( $category->term_id ) ), | |
esc_html( $category->name ) | |
); | |
// Here's the child categories | |
$term_id = $category->term_id; | |
$termchildren = get_term_children( $term_id, $category ); | |
echo '<ul>'; | |
foreach ( $termchildren as $child ) { | |
$term = get_term_by( 'id', $child, $category ); | |
echo '<li>'; | |
echo '<button class="directory--options industries">'; | |
echo '<h5 class="class="loud heading__tiniest bold blue"><a href="' . get_term_link( $child, $category ) . '">' . $term->name . '</a></h5>'; | |
echo '</li>'; | |
} | |
echo '</ul>'; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment