-
-
Save quangbahoa/e878149bf879c8e41505 to your computer and use it in GitHub Desktop.
Wordpress list terms or categories from a custom post type. wp_list_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//list terms in a given taxonomy using wp_list_categories (also useful as a widget if using a PHP Code plugin) | |
$taxonomy = 'Your_term_here'; | |
$orderby = 'name'; | |
$show_count = 0; // 1 for yes, 0 for no | |
$pad_counts = 0; // 1 for yes, 0 for no | |
$hierarchical = 1; // 1 for yes, 0 for no | |
$title = ''; | |
$empty = 0; | |
$args = array( | |
'taxonomy' => $taxonomy, | |
'orderby' => $orderby, | |
'show_count' => $show_count, | |
'pad_counts' => $pad_counts, | |
'hierarchical' => $hierarchical, | |
'title_li' => $title, | |
'hide_empty' => $empty | |
); | |
?> | |
<ul> | |
<?php wp_list_categories( $args ); ?> | |
</ul> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment