How To Set Up Google Custom Search Results Page On WordPress [Step By Step Guide]
WordPress has an in-built search which is not so effective when it comes to showing up results. This is why most websites use Google Custom Search, which allows you to make money using your Adsense account. Normally Google Custom Search results would show up on Google. However you can make these results show on your website page using the steps below.
First you need to create a Google Custom Search box. You can do this either through your Adsense account or from Google custom search website. We are using the Google CSE website in this article. Skip to the next section of the article if you already have created a Custom Search Engine.
Create Custom Search Engine
1. Go to Google Custom Search and log in with your ID. Then click on ‘Create a Custom Search Engine’. 
2. Enter the name of the search engine and description. Choose a language for the search engine (by default it is English).
3. The next step is to choose what all websites you want to include for the search engine results. By default the choice is set to ‘Only sites I select’. If you want your users to find information all over the web, then select the option ‘The entire web, but emphasize sites I select’.
4. In case of ‘Only sites I select’, you have 4 different options for filtering the search results (click on ‘Tips on formatting URLs’).
a. Specific pages of your site: E.g- www.TurningTrack.com/MyPage.html.
b. Entire site: www.TurningTrack.com/*
c. Wildcard pattern matching: www.TurningTrack.com/*search*
d. Entire domain: *.TurningTrack.com
Enter the list of all websites to include in Google Custom Search in the ‘Sites to search’ listbox.
4. Once you are satisfied with everything, choose your edition of Google custom search (standard is default, but business edition without ads available at a cost), select the ‘Terms of Service’ checkbox and click ‘Next’.

5. Here you can preview the search results by typing in queries. You can go back to the preview step by clicking on ‘back to step 1’ link. Click ‘Finish’ when you are happy with the search results.

The newly created custom search engine will be added to the list of your search engines on the ‘My search engines’ page of your Google Custom Search account.
Host Google Custom Search On Your Website
1. Sign into your Google Custom Search account and click on ‘manage your existing search engines’ (below ‘Create Custom Search Engine’ button).
2. Then click on ‘My search engines’ in the left panel, if you are not taken to this page directly.
3. You will find the list of all the custom search engines created by you. For a customizing a search engine click on it’s ‘control panel’.

4. Click on ‘Look and feel’ on the right side, and select ‘Iframe’ as the hosting option. This is needed in order to host the Google search results on your website.
5. Choose a style for the search results page, available options are Default, Bubblegum, Green Sky, Espresso, Shiny, and Minimalist.
6. Again you can preview your search results and accordingly switch to a new style by entering queries in the Google custom search box.
7. Click ‘Save’ to save the changes and then click ‘Get Code…’.

8. Enter the entire URL of the search results page. For instance www.turningtrack.com/search is the page that we are using for hosting the Google Custom Search results on our website.
9. By default the ads are placed on the Top and Right. You can also choose to display them only right or at top and bottom.
10. Now copy both the Search box code as well as the Search results code.

Set Up Google Custom Search On WordPress Page
1. Place the copied Search box code in your theme’s template (sidebar.php, header.php etc). In case you already have WordPress default search on your website, replace the code in your theme’s template files with the copied Search box code.
2. Open search.php for editing from your WordPress dashboard (or through FTP) and add the following lines of code at the top of the file if they are not already present:
[php]
<?php
/*
Template Name: Search
*/
?>
[/php]
3. Now replace all the code in the content section of search.php with the copied Search results code.
4. Now go to Add New Page (Pages –> Add new from the left panel of your WordPress dashboard). Enter ‘search’ as the page title.
5. On the right side, under the ‘Attributes’ section, click on the Template drop down menu and select ‘Search’.
6. Publish the page.

That’s it. You are done.
Go to your website and type a query in the Google custom search box. This should show up results on your website itself.
