Today you’ll learn how to add Google search to your WordPress site. We all love WordPress for the ease of use and getting a website up quickly and beautifully, but when it comes to searching for content on the site, the built in WordPress search can be a little lacking. And even though there are plugins to help with the search functionality, why create the wheel when you have Google Custom search you can use. In order to make this happen you will need a Google account.
So I’ll go to google custom search engine and click create a custom search engine button.
I want to add the website address and give it a name.
Now I just need to click get code
and i’ll copy the code
and head back over to my site. On the back end of my site, I will want to go over to appearance and then editor.
Ok, I’m looking for the searchform.php file. If you don’t see this file on the right, you’ll need to create it and upload it to your theme folder via an FTP.
Now I just need to paste the code in
and click update file.
The next step is to go to my widgets section
and drag the search widget over to the sidebar.
I can give it a title if I want and click save.
That’s all I need to do. Now I can view my site and you’ll see the Google Custom Search is here.
Now the location of the search will depend on your theme and You can also go back to your Google custom search and change the look and feel to make it look more like your site, you’ll want to make sure you take some time to do that, but that’s all you really need to do to upgrade your site’s search functionality.
Now that we’ve covered the manual process, I want to go over adding a Google search plugin. So you don’t have to mess with the code. The plugin we’ll add is search by Google. So from the dashboard, click plugin add new
and search Search by google, making sure it’s the correct one.
We’ll click install now
and click ok.
After that we can click activate plugin,
and we want to add the widget to our site. So I’m going to go to the widget section,
find the Search by Google widget and drag it over to the widget area. Now you see when it expands you want to make sure you add the site address.
This tells Google which results to bring back for the search. now you can view your site and see how the search box looks and test it out.