How to Use Drupal 7 Views to Count Content

Here's how to quickly use Views UI to count content in your Drupal database. You can then display the counts as Blocks or even pages or just use them internally as site admin. The only prerequisite is to have Views and VIews UI enabled.

  1. Create a new view of content (aka nodes). Leave out sorting! (Sorting/ordering won't be visible in the count anyways but can prevent counting from working.)
  2. Under Advanced settings, enable Use aggregation to Yes.
  3. Under FIELDS, only use one main field, such as a title or nid. There should be Aggregation settings next to it. Set this to COUNT.
  4. That's it. You can add FILTER CRITERIA to reduce the counted content. Don't add SORT CRITERIA. Paging/more is also not applicable here.
How to Use Drupal 7 Views to Count Content | TECH.SAIGONIST.COM

Error

×

Error message

  • Warning: Cannot modify header information - headers already sent by (output started at /home/tomo/web/tech.saigonist.com/drupal7/php/includes/common.inc:2776) in drupal_send_headers() (line 1486 of /home/tomo/web/tech.saigonist.com/drupal7/php/includes/bootstrap.inc).
  • Error: Class 'CToolsCssCache' not found in _cache_get_object() (line 32 of /home/tomo/web/tech.saigonist.com/drupal7/php/includes/cache.inc).
The website encountered an unexpected error. Please try again later.