Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
To print the name of a node's content type, add these lines into your theme's node.tpl.php file.
Print the names for all types of nodes
<?php
print node_get_types('name', $node);
?>
Exclude a single content type's name from being printed
<?php
print $node->type != 'page' ? node_get_types('name', $node) : '';
?>
Exclude multiple content types' names from being printed
<?php
if (!in_array($node->type, array('story', 'page'))) {
print node_get_types('name', $node);
}
?>
See http://api.drupal.org/api/function/node_get_types/ for more information.
Comments
What is this
How is someone supposed to tell which version of Drupal this is for? This post has no date, no breadcrumb, no labels or tags. Drupal docs are a hot mess!