#96: Templates for Search Results

(Updated on )

Search works! It’s just the template that you land on isn’t quite right. We need to tweak up the template so it looks right and matches the style of the site.

The template that search uses at the start pretty generic. It’s a template that I use on lots of WordPress sites. It’s just like “page.php” – the “Default” template that all WordPress pages use, only it doesn’t make the get_sidebar() call. I call it page-nosidebar.php.

Ultimately we ditch that template and make a template specific for search results. This gives us more specific control over these pages. This means we need to go into each search results page in WordPress and make sure it’s using this template. Anytime we do something like that, we should take note, because we’ll have to change that on the live site manually after we go live (changes like that don’t go up with Version Control).

This new template makes it easy for us to apply CSS just to this page as well, using logic in the header.php file that we’ve done so many times. We spend a bunch of time poking at the styling of what comes across by default from GCSE. We remove some cruft, adjust some spacing, change some fonts, etc.

We wrap up pontificating about more work that needs to be done.