How To Install Google Custom Search With Search Result Within Your Website The Easiest Way
I have install google custom search at my website.
You can see it neatly at the top of my right sidebar.
Benefits of Google Custom Search
With Google Custom Search, you can give a better search experience to your website visitors. As we all might know, Google is the LARGEST SEARCH ENGINE nowaday, right at the time of this post was written.
Being the largest and top is not as simple like what you may think.
It needs a technology that advance than the competitors.
Hence, Google’s technology in indexing and searches is the best!
Not even the built in WordPress search feature.
Other than that, you can combine all your websites in one search result if it having the related keywords.
In other words, you can limits the search result to only websites of your like. Example, your own websites.
Other benefit that might interest you,
you could monetize your search result while giving the best to your visitors.
Cons of Google Custom Search
Will not return result of unindexed pages of your website.
Installing The Google Custom Search Which Returns The Search Result In Your Website
This example is done with wordpress default theme.
First thing we have to do is getting the code of google custom search.
To do this, you have two option, using adsense or directly to google custom search website.
But both wizard is identical, so don’t worry much about it.
At the first page of the wizard, fill all required field to your like and then click continue.
At the second page of the wizard, you are presented with options on how to customize the look of your search form.
My recomendation is please make the text box lenght to 18 or shorter than that according to your sidebar width.
But if you planning to put your custom search on more wider placement, you can make the number greater.
The third wizard show you an option on where the search result will come out.
Please select Open results within my own site .
Before you fill out this field, please open a new window/tab on your browser and login to your wordpress dashboard and make a new page.
Click save draft and the permalink of the page will be visible underneath the title field area.
Copy the permalink and paste it on the field at the google custom search wizard just now.
You can customize the color palete according to your site scheme color.
After that, you will have two codes, one for the search form, and one for the search result.
Now let’s get our hand dirty with these codes.
Open the page.php of your theme and find this code.
<?php the_content('<p class="serif">Read the rest of this page »</p>'); ?>
Paste the code of the search result under this code or replace it.
After that, paste the code below at the very top.
<?php
/*
Template Name: Google Search Result
*/
?>
The code above will register this template page into wordpress.
Now save as googlesearchresult.php
After that, upload this new page template into the theme folder.
In this example, upload it to wp-content/themes/default
Now edit the draft that we made before and make sure the page template is Google Search Result and then publish this page.
The next step you should do is go to appearance ==> widget ==> and add text widget.
Paste the search form code there.
Click done and then click save.
We are done!


about 10 months ago
about 10 months ago
about 6 months ago
about 6 months ago
about 6 months ago
Till then,
Jean
about 6 months ago
about 6 months ago
about 5 months ago
great article
thanks