WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible in wordpress to customise the search page to show certain information depending on the result?

For example I run a motorsport site and if I searched for Jenson Button it would return a page with all the posts mentioning Jenson Button ( http://www.thecheckeredflag.co.uk/?s=Jenson+Button ).

Is it possible to customise this page to show a div at the top with relevant links about that Jenson Button or whatever driver/search term the user is looking for?

share|improve this question
up vote 1 down vote accepted

You can create a template file in your theme that is used to display search results. It is called search.php. If it does not exist the index.php file is displayed.

At the top of that file, or wherever you want, you can place extra code that queries your special posts (depending on how you saved driver data). You can get the current search query by calling get_query_var( 's' ).

share|improve this answer
I'll give it a go... thanks! – Vince Pettit Jan 21 '11 at 11:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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