I want to expose in a block the number of content type published by the current user. I know we can write a query, but is there any other method to do it?

2 Answers 2


You can use the Views module to do this.

  1. Create a new view
  2. Remove sort options, fields and other default settings
  3. Add a field for "Content: Type"
  4. Expand the "advanced" part on the right and set "Use aggregation" to "Yes"
  5. Add yet another field for "Content: Type"
  6. On the second "Content: Type" field, click "Aggregation settings"
  7. Set the aggregation type to "count"
  8. The second "Content: Type" should now look like "COUNT(Content: Type)"

THIS IS NOT MY SOLUTION LOOK HERE: Count of nodes by type


The two ways that come to mind are to write a custom query as you suggest, or use the Views module to create a block with the content you need.

Views essentially provides a UI for creating custom queries that you can then automatically add to a block/full page/etc.

Depending on your level of PHP/MySQL experience it may actually be easier to write the query yourself...Views has a fair bit of a learning curve although there are a lot of tutorials out there if you search on Google.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.