I am trying to hide the title of the current page (as printed by page.tpl.php
) if the current page is 1) a node in full display (as opposed to teaser mode), AND 2) the node type is either concert or bio. I print the node title for these content types directly in the node content, so I want to hide the duplicate being printed by page.tpl.php. I am not able to get this to work directly in page.tpl.php, and my reading suggests the best practice is to handle template logic in template.php using preprocess and process functions. So, I am trying to hide the current page title (with the above 2 conditions) using template_preprocess_page()
. This is my code.
<?php
function MYTHEME_preprocess_page(&$variables) {
if (!empty($variables['node']) && $variables['node']->type == 'concert') {
hide($variables['title']);
}
}
?>
I read How do I test for node type to print a variable from template.php? and the documentation page for template_preprocess_page()
, and various other sites, but I just can't seem to get this to work. I saw suggestions that you have to call isset()
on $variables['node']
before testing for the node type, but that didn't work either. I didn't see a clear solution posted anywhere, and I'm at my wit's end.