0

I have customize my teaser view of my content types. Now i want to show that teaser view in search result page also. How can i do this? If anyone can give me a example with code will great help.

0
  1. You can use template_preprocess_search_result for that

    function MYTHEME_preprocess_search_result(&$vars) {
      $node = $vars['result']['node'];
      if ($node->nid) { // here you load the teaser if the result is a node
        $vars['teaser'] = node_view($node, 'teaser'); 
      }
    }
    
  2. You can make a template file to customize the result: https://api.drupal.org/api/drupal/modules!search!search-result.tpl.php/7.x

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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