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?
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 theindex.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' )
.