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
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.
Hope this will help you.
In Drupal 7 , if you dont want any modules then you can use template preprocess functions for you requirement.
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'] = '';
}
}
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;
}
}
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.
$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.