Drupal - Show the taxonomy in the format - "term(node count)" - for a given vocabulary
Copy this code and paste it in your HTML
<?php
$vid = 1;
$vocab = taxonomy_get_tree($vid);
$terms = array();
foreach ($vocab as $key=>$value) {
$count = db_result(db_query("SELECT COUNT(nid) as count FROM {term_node} WHERE tid = %d", $vocab[$key]->tid));
print '
<li><a href="/'.drupal_get_path_alias('taxonomy/term/'.$vocab[$key]->tid).'">'.$vocab[$key]->name.'
</a> ('.$count.')
</li>';
}
?>
Report this snippet
Comments
Subscribe to comments