Architectural Blog, Modern Buildings & Casino Designs Loading...

Using custom template files different

You can use custom template files for different view modes really easily in Drupal 7 by adding this to your theme’s template.php file:

function THEMENAME_preprocess_node(&$vars) {  // Custom display templates will be called node--[type]--[viewmode].tpl.php   $vars['theme_hook_suggestions'][] = 'node__' . $vars['type'] . '__' . $vars['view_mode']; }

You can then make your own copy on node.tpl.php and rename it node–[type]–[viewmode].tpl.php and it will only apply to the content type [type] when it is displayed in the view mode [viewmode] for example node–article–teaser.tpl.php.