Created
February 2, 2015 04:52
-
-
Save Aziz-Rahman/383c49734f77db559cb1 to your computer and use it in GitHub Desktop.
Get Terms Taxonomy in Wordpress
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 | |
// Select taxonmony | |
$taxonomies = array( | |
'kb_category', | |
); | |
// Filter taxonomy | |
$args = array( | |
'hide_empty' => false, | |
); | |
// Get taxonomy data | |
$terms = get_terms( $taxonomies, $args ); | |
// Loop each taxonomy | |
foreach( $terms as $catsid ) : | |
if( $catsid ) : | |
$args = array( | |
'type' => 'post', | |
'hide_empty' => 0, | |
'hierarchical' => 0, | |
'taxonomy' => 'kb_category', | |
'pad_counts' => false | |
); | |
$mycats = get_categories( $args ); | |
$taxonomy = 'kb_category'; | |
$term = get_term( $catsid, $taxonomy ); | |
$term_name = $term->name; | |
$term_slug = $term->slug; | |
$term_count = $term->count; | |
?> | |
<!-- Data ditampilkan --> | |
<?php echo $term_name; ?><span class="article-count"><?php echo $term_count; ?> <?php _e('articles', 'nama_theme'); ?></span> | |
<!-- Etc Data ( dll ) --> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment