Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Google Custom Search: Where Does Their Code Go? Re: Google Custom Search: Where Does Their Code Go?

#72966
jamygolden
Moderator

First, create a copy of the page.php file and rename it t ‘page-search-results.php’. Open page-search-results.php and replace the commented area just after with the following comment:

/**
Template Name: Search Results
**/

Now you have a special search-results page template that you can customize.

Now create a page in wordpress called 'Search Results'—before you click 'create', make sure you change the page template to 'Search Results'.

Once that is done, create an adsense account (if you haven't already) and create a Google Custom Search. It will ask you a few questions, like what is the url of the page it will be displayed on, etc. Once this is all done, it will give you two snippets of code. The one snippet is the search box itself—that goes in the header, or sidebar, etc. The second snippet goes on page-search-results.php.
Once you click search, everything should work.