<?php
$terms = get_terms( array(
'taxonomy' => 'destination', // set your taxonomy here
'hide_empty' => false, // default: true
) );
if ( empty( $terms ) || is_wp_error( $terms ) ) {
return;
}
echo '<ul>';
foreach( $terms as $term ) {
printf(
'<li><a href="%s">%s</a> <span class="term-count">(%s)</span></li>',
esc_url( get_term_link( $term ) ),
esc_attr( $term->name ),
$term->count
);
}
echo '</ul>';
?>
<?php
$args = array(
'show_option_all' => '',
'orderby' => 'name',
'order' => 'ASC',
'style' => '',
'show_count' => 1,
'hide_empty' => 0,
'use_desc_for_title' => 1,
'child_of' => 0,
'feed' => '',
'feed_type' => '',
'feed_image' => '',
'exclude' => '',
'exclude_tree' => '',
'include' => '',
'hierarchical' => 2,
'title_li' => __( '' ),
'show_option_none' => __('No categories'),
'number' => null,
'echo' => 1,
'depth' => 2,
'current_category' => 0,
'pad_counts' => 0,
'taxonomy' => 'destination',
'walker' => null
);
wp_list_categories( $args );
?>
<?php
$wcatTerms = get_terms('destination', array('hide_empty' => 0, 'parent' =>0));
foreach($wcatTerms as $wcatTerm) :
?>
<div class="dest item">
<?php echo $wcatTerm->name; ?>
<div class="cov">
<?php
$wcatTerms1 = get_terms('destination', array('hide_empty' => 0, 'parent' =>$wcatTerm->term_id));
foreach($wcatTerms1 as $wcatTerm1) :
?>
<a href="<?php echo get_term_link( $wcatTerm1->slug, $wcatTerm1->taxonomy ); ?>"><?php echo $wcatTerm1->name; ?></a>
<?php endforeach ; ?>
</div>
</div>
<?php endforeach ; ?>