Drupal 7 How to override page.tpl for specific content type?

drupal, drupal-7, drupal-theming

Solution

You have to make sure that your template can handle this ... I got a code snippet that worked for me here:

http://drupal.org/node/1089656#comment-4426790

<?php
function themeName_preprocess_page(&$vars, $hook) {
  if (isset($vars['node'])) {
    // If the node type is "blog_madness" the template suggestion will be "page--blog-madness.tpl.php".
    $vars['theme_hook_suggestions'][] = 'page__'. $vars['node']->type;
  }
}
?>

Problem

I wanted to override page.tpl.php for specific content type. I have tried these thing, nothing works for me. - `page--article.tpl.php` - `page--node--article.tpl.php` - `page--node--type--article.tpl.php` - `page--node-type--article.tpl.php` - `page--type--article.tpl.php` But when I targetted specific node by number i.e. `page--node--8.tpl.php` it worked fine. I think `page--article.tpl.php` should have worked, but I dont know why its not working. Please tell me if I am naming it wrong. and how can I debug such things. I have heard I can use Devel module, but know nothing about it. A slight hint in right direction will be appreciated. Thanks in advance

Original source