3

I've saw How to provide template for particular view mode?, but I don't to create a single tpl for every content type for a particular view mode, but a tpl used for every content type for a particular view_mode, something like node--search-results.tpl.php

Is it possible?

1 Answer 1

5

Certainly, just add the following code to your theme's template.php file (replacing MYTHEME with the name of your theme):

function MYTHEME_preprocess_node(&$vars) {
  $vars['theme_hook_suggestions'][] = 'node__' . $vars['view_mode'];
}

And remember to clear the caches

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.