Google Custom Search WordPress Plugin
WordPress has a relatively good search functionality but tends to get sluggish and doesn’t match keywords that well. This is even more apparent when your site is quite large and you have many posts and/or pages. In addition, wordpress search functionality display results ordered by date and not by its relevance to the keywords.
Also Google Custom Search Engine is not limited to just your site. You can configure it through google to search multiple sites/domains.
Or how about having a search Engine with searches all websites within your blog’s niche?
Combining Google’s search engine along the familiarity of their interface, this is a must have plugin for all websites.
The plugin is very flexible and you can configure the both the search box and the search results.
Google Custom Search widget’s search box can be displayed as either a widget or placed anywhere in the code.
The search results can be displayed in one of three formats.
- As a pop-up resizable dialog.
- Within the widget, under the search box.
- Displayed anywhere in the code.
See Google Custom Search Engine WordPress Plugin in Action
- Little Handy Tips – We use the plugin on our own site to display the search results as a pop-up dialog.
- Wollongong Fitness – A fitness website which has the display of the search results customized to be displayed in a different place.
If you find the Google Custom Search Engine WordPress Plugin useful, show your support and make a donation.
This section describes how to install the google custom search engine wordpress plugin and get it working.
- Upload the folder `google-custom-search` to the `/wp-content/plugins/` directory.
- Activate the plugin through the ‘Plugins’ menu in WordPress.
- Go to the Options and configure the Google Custom Search.*
*You might need to setup a Custom Search Engine Account with Google.
- Add Google Custom Search Widget.
Display Search Box
To display the search-box anywhere in the code, the following method should be used
<?php display_search_box($display_results_option); ?>
where $display_results_option is one of the following three options.
DISPLAY_RESULTS_AS_POP_UP – displays the search results as a pop-up resizeable dialog
DISPLAY_RESULTS_IN_UNDER_SEARCH_BOX – displays the search results under the search box
DISPLAY_RESULTS_CUSTOM – displays the search results in the place you have specified.
Below is an example.
<?php display_search_box(DISPLAY_RESULTS_AS_POP_UP); ?>
Display Search Results
To specify a location where the search result is to be displayed, the following method should be used.
<?php display_gsc_results(); ?>
- Version 1.3.4
- Fix compatibility issue with wordpress 3.4.
- Fix issue with pop-up box display not working on some browser.
- Version 1.3
- Added multilingual support.
- Added option to have results displayed in current window instead of a new window.
- Added option to not display search button.
- Version 1.2
- Fixes problem where plugin interferes with other wordpress drag and drop functionality.
- Version 1.1
- Added support for multiple custom search boxes in a single page.
- Version 1.0
- Initial Release
Frequently Asked Questions
Q. Does this plugin replaces the wordpress plugin?
Yes and No.
The Google Custom Search plugin does not override the wordpress search functionality.
You can choose to have it replace wordpress’s search but removing their search and putting this plugin instead.
Q. My current website search box is not in a widget. Can I replace wordpress search with this plugin?
Yes. You sure can.
You will need to modify the wordpress theme you are using and replace the wordpress search code with this plugin’s API.
To display the search-box anywhere in the code, refer to the section above on Advanced Configuration
Q. How do I specify where the search results are to be displayed?
The search results can be configured within the widget to display in one of three options.
- As a pop-up dialog.
- Within the widget.
- In an area you specify.
If you want to specify the location for the results to be displayed, you will need to do the following.
- Make sure the setting on the widget for “Display Results” is set to “Elsewhere”
- Add the following line of code into your wordpress theme at where you want to results to be displayed.
<?php display_gsc_results(); ?>
Q. Can Google Custom Search search other/multiple websites?
This configuration will need to be done with Google and documentation for that is provided by them.
Go to http://www.google.com/cse/manage/all to configure your Google Custom Search Engine.
Q. How do I create a Google Custom Search Engine?
Go to http://www.google.com/cse/manage/create and follow the instructions.
More Questions or Comments?
There is now a Forum for supporting this plugin
As there are now too many comments on this page, I’ve created a forum for support of the plugin. It’ll make it easier for plugin users to browse through the list of questions which have already been asked before. If you have any questions regarding the plugin, please go to http://forum.littlehandytips.com
If you’re having problems with getting the plugin to work, take a look at 3 Easy Steps to Diagnose WordPress Plugin Problems.
Also even though the plugin is free, providing support can be time-consuming. Therefore if you like to make a donation, it will be greatly appreciated. I don’t always have time to respond to all support requests, but if you make a donation, I will make your question a priority. Thanks.