Template suggestions not recognized I have just introduced my custom template suggestions in MYTHEME_preprocess_node, based on a certain field's value. Won't work somehow.

The content type is project. In my template folder I have already a file named node--project.tpl.php, and my suggestions append additional two: node--project--pcgame.tpl.php and node--project--movie.tpl.php. They are visible when I dpm() the variables, but are not found/applied to the node, even when I remove node--project.tpl.php.

Cache cleared.

Any clue as per what could be the cause?



The code I'm using:

function MYTHEME_preprocess_node($variables){
  if(isset($variables['node'])){
    $node = $variables['node'];
    if($node-&gt;type == 'project'){
      // Determine project type based on a term field.
      $project_type = (int) $node-&gt;field_genre['und'][0]['tid'];

      switch($project_type){
        case 4:
          $variables['theme_hook_suggestions'][] = 'node__project__pcgame';
          break;
        default:
          $variables['theme_hook_suggestions'][] = 'node__project__movie';
      }
      dpm($variables['theme_hook_suggestions']);
      }
   }
}
You try this code.

 function youthemename_preprocess_node(&amp;$variables) {
 $node = $variables['node'];
    if($node-&gt;type == 'project'){
      // Determine project type based on a term field.
      $project_type = $node-&gt;field_genre['und'][0]['tid'];

      switch($project_type){
        case 4:
          $variables['theme_hook_suggestions'][] = 'node__project_pcgame';
          break;
        default:
          $variables['theme_hook_suggestions'][] = 'node__project_movie';
      }
    }   
}


You file name should be node--project_pcgame.tpl.php and node--project_movie.tpl.php.
Clear performance cache, it should call hook_theme_registry_alter(&amp;$theme_registry).