persepolis
persepolis

Reputation: 789

How to make a block listing taxonomy terms in a hierarchy (Drupal 7)

So I have a taxonomy hierarchy (assigned to blog posts as free tags) that looks, say, something like this (apologies, it's totally arbitrary for testing purposes right now):

Example taxonomy terms

I'd like to create a block that simply outputs what I see in this menu: The taxonomy terms, ordered into a heirarchy, with links to the taxonomy term page (listing all content that this term is attached to). Ideally also, a count for the number of nodes each term is attached to.

At first I tried defining a block and used taxonomy_get_tree but that was a bit of a deal trying to recursively turn the output of that function into something I could work with. I also tried views, bringing in taxonomy terms but I couldn't get them to display as a hierarchy, or get the count to show.

So I'm a bit stumped. Any thoughts?

Upvotes: 4

Views: 4597

Answers (1)

jsheffers
jsheffers

Reputation: 1622

Have you checked out the taxonomy menu module - http://drupal.org/project/taxonomy_menu This module does everything you mentioned as well as outputting the number.

Upvotes: 5

Related Questions