1

I have tried doing this in hook_node_view or hook_node_view_alter with no luck:

I have tried things like: unset( $node->title); or $node->title ='';

note: my node was created using panel nodes

4 Answers 4

3

The Exclude Node Title module has that functionality if you'd prefer a non-code solution.

This module handles a very simple functionality, decide whatever to exclude a node title from full node page or node teasers.

1
  • I also thought about mentioning it but didn't because I though he is asking about node display page only..
    – RajeevK
    Aug 13, 2013 at 11:09
3

Hope this will help you.

In Drupal 7 , if you dont want any modules then you can use template preprocess functions for you requirement.

  • template_preprocess_page
    function THEMENAME_preprocess_page(&$vars) {
        if ($vars['is_front']) {//for home page
          $vars['title'] = '';
        }
        elseif (!empty($vars['node']) && in_array($vars['node']->type, array('NODETYPE1', 'NODETYPE2'))) {//for specific node type(NODETYPE1 OR NODETYPE2)
          $vars['title'] = '';
        }
    }
    
  • You can also use template_preprocess_node
    function YOURTHEME_preprocess_node(&$node) {
          // check for node type
            if(in_array($node['type'], array('NODETYPE1', 'NODETYPE2'))) {//for specific node type(NODETYPE1 OR NODETYPE2)
             $node['title'] = NULL; 
          }
    }
    
1

If you use modules display suite or/and page manager (part of ctools), you could have more control of all the fields, including the title.

2
0

$title is not inside the $node variable but independent. You will find it inside page.tpl.php rather than node.tpl.php, where usually we guess at first.

So if you are trying to hide it then you should better do some action on this one or just hide it from your specific page.tpl.php.

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.