Skip to main content
edits
Source Link
niksmac
  • 7.7k
  • 3
  • 31
  • 69

You try this code.

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

 function youthemename_preprocess_node(&$variables) {
 $node = $variables['node'];
    if($node->type == 'project'){
      // Determine project type based on a term field.
      $project_type = $node->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(&$theme_registry).hook_theme_registry_alter(&$theme_registry).

You try this code.

function youthemename_preprocess_node(&$variables) { $node = $variables['node']; if($node->type == 'project'){ // Determine project type based on a term field. $project_type = $node->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(&$theme_registry).

You try this code.

 function youthemename_preprocess_node(&$variables) {
 $node = $variables['node'];
    if($node->type == 'project'){
      // Determine project type based on a term field.
      $project_type = $node->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(&$theme_registry).

Source Link
Sathiya
  • 512
  • 3
  • 8

You try this code.

function youthemename_preprocess_node(&$variables) { $node = $variables['node']; if($node->type == 'project'){ // Determine project type based on a term field. $project_type = $node->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(&$theme_registry).