Created
February 24, 2019 03:55
-
-
Save jabaltorres/92ea841806980a15a34482c930cfbdbf to your computer and use it in GitHub Desktop.
How to display wordpress categories
This file contains 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
<?php | |
// How to display categories | |
$args = array( | |
'taxonomy' => 'test', | |
'orderby' => 'name', | |
'order' => 'ASC' | |
); | |
$cats = get_categories($args); | |
echo '<ul class="terms">'; | |
foreach($cats as $cat) { ?> | |
<li><a href="<?php echo get_category_link( $cat->term_id ) ?>"> | |
<?php echo $cat->name; ?> | |
</a></li> | |
<?php | |
} | |
echo '</ul>'; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment