Count of nodes by type I am looking for a snippet that lets me display the total count for a specific node type, e.g. "Pages = 167" or "Products = 10630."

What code should I use to achieve this?
You can use the Views module to do this.


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


That should be it! If needed, adjust some more settings like field labels and row style settings.

Here is an export of such a view, so you can easily import it and try it out:

$view = new view;
$view-&gt;name = 'nodecounts';
$view-&gt;description = '';
$view-&gt;tag = 'default';
$view-&gt;base_table = 'node';
$view-&gt;human_name = 'Node counts';
$view-&gt;core = 7;
$view-&gt;api_version = '3.0';
$view-&gt;disabled = FALSE; /* Edit this to true to make a default view disabled initially */

/* Display: Master */
$handler = $view-&gt;new_display('default', 'Master', 'default');
$handler-&gt;display-&gt;display_options['title'] = 'Node counts';
$handler-&gt;display-&gt;display_options['group_by'] = TRUE;
$handler-&gt;display-&gt;display_options['access']['type'] = 'perm';
$handler-&gt;display-&gt;display_options['cache']['type'] = 'none';
$handler-&gt;display-&gt;display_options['query']['type'] = 'views_query';
$handler-&gt;display-&gt;display_options['query']['options']['query_comment'] = FALSE;
$handler-&gt;display-&gt;display_options['exposed_form']['type'] = 'basic';
$handler-&gt;display-&gt;display_options['pager']['type'] = 'none';
$handler-&gt;display-&gt;display_options['style_plugin'] = 'default';
$handler-&gt;display-&gt;display_options['row_plugin'] = 'fields';
$handler-&gt;display-&gt;display_options['row_options']['inline'] = array(
  'type_1' =&gt; 'type_1',
  'type' =&gt; 'type',
);
$handler-&gt;display-&gt;display_options['row_options']['separator'] = ': ';
$handler-&gt;display-&gt;display_options['row_options']['hide_empty'] = 0;
$handler-&gt;display-&gt;display_options['row_options']['default_field_elements'] = 1;
/* Field: Content: Type */
$handler-&gt;display-&gt;display_options['fields']['type_1']['id'] = 'type_1';
$handler-&gt;display-&gt;display_options['fields']['type_1']['table'] = 'node';
$handler-&gt;display-&gt;display_options['fields']['type_1']['field'] = 'type';
$handler-&gt;display-&gt;display_options['fields']['type_1']['label'] = '';
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['alter_text'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['make_link'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['absolute'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['external'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['replace_spaces'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['trim_whitespace'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['nl2br'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['word_boundary'] = 1;
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['ellipsis'] = 1;
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['strip_tags'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['trim'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['alter']['html'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['element_label_colon'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['type_1']['element_default_classes'] = 1;
$handler-&gt;display-&gt;display_options['fields']['type_1']['hide_empty'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['empty_zero'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['hide_alter_empty'] = 1;
$handler-&gt;display-&gt;display_options['fields']['type_1']['link_to_node'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type_1']['machine_name'] = 0;
/* Field: COUNT(Content: Type) */
$handler-&gt;display-&gt;display_options['fields']['type']['id'] = 'type';
$handler-&gt;display-&gt;display_options['fields']['type']['table'] = 'node';
$handler-&gt;display-&gt;display_options['fields']['type']['field'] = 'type';
$handler-&gt;display-&gt;display_options['fields']['type']['group_type'] = 'count';
$handler-&gt;display-&gt;display_options['fields']['type']['label'] = '';
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['alter_text'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['make_link'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['absolute'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['external'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['replace_spaces'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['trim_whitespace'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['nl2br'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['word_boundary'] = 1;
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['ellipsis'] = 1;
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['strip_tags'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['trim'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['alter']['html'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['element_label_colon'] = FALSE;
$handler-&gt;display-&gt;display_options['fields']['type']['element_default_classes'] = 1;
$handler-&gt;display-&gt;display_options['fields']['type']['hide_empty'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['empty_zero'] = 0;
$handler-&gt;display-&gt;display_options['fields']['type']['hide_alter_empty'] = 1;
$handler-&gt;display-&gt;display_options['fields']['type']['separator'] = '';
$handler-&gt;display-&gt;display_options['fields']['type']['format_plural'] = 0;

/* Display: Block */
$handler = $view-&gt;new_display('block', 'Block', 'block');