Wordpress exclude terms from list and add post count
I'm trying to list all Product Categories within WooCommerce and the
snippet below is working a treat but I'm wanting to exclude terms
(categories) from the list and add post count to each Category. If anyone
could help me out and point me into the right direction I'd truly
appreciate it.
<?php
$terms = get_terms('product_cat');
$count = count($terms);
if ( $count > 0 ){
echo "<ul>";
foreach ( $terms as $term ) {
echo "<li>";
$terms = get_terms($term->name);
echo "<a href='".get_term_link($term)."'>";
echo $term->name;
echo "</a>";
echo "</li>";
}
echo "</ul>";
}
?>
No comments:
Post a Comment