What do I delete to remove the header on a page-node-[content type].tpl.php?

I have deleted the whole heading, but it still displays. I want the content to start on the top of the page.

Thanks

Comments

shruti.sheth’s picture

Hello,
I hope my answer proves helpful to you for solving this issue.
I performed the following steps to create a custom page-[content-type].tpl.php and was successful in removing the heading from it and start the content from the top of the page.

STEPS :
1. Added the following code in template.php, please replace my_theme to the custom theme name


function my_theme_preprocess_page(&$vars) {
  // Add per content type pages
  if (isset($vars['node'])) {
    // Add template naming suggestion. It should alway use hyphens.
    // If node type is "custom_news", it will pickup "page-custom-news.tpl.php".
    $vars['template_files'][] = 'page-'. str_replace('_', '-', $vars['node']->type);
  }
}

2. Created a page-[content-type].tpl.php, in the page-[content-type].tpl.php please replace [content-type] with the machine name of the content-type for which custom page.tpl.php is required

3. If the heading is to be removed , the following code needs to be removed from page-[content-type].tpl.php

<?php 
		 if ($title): 
		 if ($is_front){/* if we are on the front page use <h2> for title */
		 print '<h2'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h2>'; 
		 }
		else {print '<h1'. ($tabs ? ' class="with-tabs"' : '') .'>'. $title .'</h1>';  /* otherwise use <h1> for node title */
		 }
		 endif; ?>

Please clear the cache

Thanks

oadaeh’s picture

Issue summary: View changes
Status: Active » Closed (won't fix)

This issue is being closed because it is against a branch for a version of Drupal that is no longer supported.
If you feel that this issue is still valid, feel free to re-open and update it (and any possible patch) to work with the 7.x-4.x branch.
Thank you.