Today I am going to show you how to create a taxonomy term count block using views in drupal7. You don't need to have any aditional modules for this other than views and ctools. I write this post becasue I found many people are asking how to setup this and is there any module available? ( And the answer is simple and just follow the below steps.

Required Modules

  1. Views3
  2. ctools

Modules Installation

Download all the modules and install in the directory yoursitename/sites/all/modules. Next go to admin/modules and enable the Chaos tools, Views & Views UI modules.

Create your Content & Taxonomy Term

Create a vocabulary and add the vocabulary term field to any of your content type such as blog, artice etc.

Create View & Block

Go to /admin/structure/views and create a new Taxonomy term view. (Note: Make sure you don't create page or block view from beginning.)

Taxonomy Term View

Views Other

Enbale Views aggregation to Yes

Views Field

Add taxonomy term field and set aggregation as Gorup results together next add one more taxonomy term field and this time set the aggregation as Count (Note: You can also set prefix "(" and suffix")" for taxonomy term count field. So that it will be looking like this ⇒ Drupal (6)

Views Field Formatting

Under the views field settigs check the fields you want to show as inline. So that taxonomy term and the count field will be displayed as inline.

Field Row Style -Inline

View Pager

Set the pager to Display specified items and add the number of terms ou want to show (I set it as 5 terms)

Views Sorting

Next let's sort the list of the term by most used. So add a Taxonomy term name sort field and sort it as descending now set the Aggrergation as count now you see the top 5 most used taxonomy term in the preview area.

Create Block View

Now just add a new block view and go to /admin/structure/block and enable the block we just creted using views!

See the views setings screen shot for refernce.

Taxonomy Count Block - Views Aggregation settings

That is the end of this tutorial. Please feel free to ask me if you have any quesetions, doubts or having any difficult to setup.