i am trying to override the search-results page with no luck. All of the answers that i have found in google are about overriding the results template. since i am using a subtheme i want to override the whole HTML output of the page. I want to change the header, the footer etc..

Instead results page is using the page.tpl.php. So far i found this How to theme the page template for search results with no success. Any correct way i can succeed this ?

Also i am trying to force the search to search only in specific content types and languages! Any suggestions?

2 Answers 2


Hope this will help you,

In Drupal 7, you can also achieve this

Using theme_search_results OR theme_search_result to override search results page.

  • theme_search_results : invoked for the search result page.


  • theme_search_result : invoked to render a single result

    Both these theme functions used in a template file (search-results.tpl.php and search-result.tpl.php).


  • Yes i have read about that and also tried them. what i did was actually took the theme_search_reults.tpl.php file from the module path and pasted it to my template file. I edited the template and added the HTML and Regions i wanted to be displaed. Clean my cache and ran a search but still the page did not change. Is this the correct way to override the whole page? Because currently my results page seems exactly as my page.tpl.php template.
    – paranod
    Commented Jul 27, 2013 at 15:14

I would suggest you to do it by help of Display Suite module for search results.

Once you enable this module, you will find Manage Display tab when you visit your edit content type. Click to Manage Display -> Custom display setting -> check Search result & save.

Now you can manage your Search result display by clicking sub-tab in the Manage Display page. Arrange your field in the way which you want to be displayed & save.

For full page layout, you can go for making a page--search.tpl.php. Remove or add the regions or HTML text which you want, clear the cache & ready to go.

If this TPL doesn't work then you have to declare it in template.php using theme_hook_suggestions in the same way as answer of your linked question. See for the URL which your instance is using for giving search result.

For $base_url/search use

//replace your theme name with MYTHEME
function MYTHEME_preprocess_page(&$vars) { 
  if (arg(0)=='search') {
    $vars['theme_hook_suggestions'][] = 'page__search';

Add this in your template.php & as you are suggesting TPL for page, you have to use THEME_preprocess_page($vars).

  • I have tried the Full page layout but the path in Drupal when i ran a search becomes $base_url/search/node/search-term. Anything that i might doing wrong?
    – paranod
    Commented Jul 27, 2013 at 15:16
  • @paranod What is name of your search tpl file ?
    – RajeevK
    Commented Jul 27, 2013 at 16:45
  • i named it page--search.tpl.php .
    – paranod
    Commented Jul 28, 2013 at 18:03
  • @paranod - Did you put my given code into your template.php & cleared your cache after replacing MYTHEME with your theme name ?
    – RajeevK
    Commented Jul 30, 2013 at 4:32

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.