There is something you should know about WordPress’ standard search feature – it is awful. For anything more than the most basic of blogs, it is extremely limited. It sorts results by reverse chronological order (rather than by relevance), and shows by default the first 55 characters of a page or post (rather than a relevant excerpt).
This is a big problem for any WordPress blogger, because people are used to finding things by searching. Navigation elements are all well and good, but many people will never go near a category link or a tag. Wen surfers have been conditioned to search by default.
The crux of the issue is that people want to search, and they expect quality results. They have been spoilt by Google. Meanwhile, the WordPress search engine generally returns poor quality (and even irrelevant) results.
Fortunately, there is an ideal solution – Google itself. The world’s most popular search engine gives you the tools with which you can create your own customized search engine for your site alone.
The bad news is that creating your own custom search engine and integrating it with your site is somewhat complicated. The good news is that the Google Custom Search plugin will do all of the hard work for you. You can have Google-powered search on your site within minutes – the following is a step by step setup guide.
1. Create a Custom Search Engine
Once you have downloaded, installed and activated the Google Custom Search plugin, you need to create your search engine. Fortunately, this is not a complicated procedure. Head over to this page and fill in the relevant information. You will of course want to enter your blog’s full URL where requested.
You will no doubt note the two different “Editions” on offer – the free version (with advertising), and the paid version (without advertising). Advertising is the price you pay for quality search results – unless of course you are prepared to fork out for the paid version.
Once you have made your choice, check the box to agree to Google’s Terms of Service and hit “Next”.
2. Select Your Style and Test Your Search Engine
Google offers up a variety of different “styles” for your search engine:
The Default style is most reminiscent of Google’s own search engine results, so we would recommend that you stick with it (for usability’s sake).
Once you have made your selection, you can test out the search engine by entering a query into the search box. You should take this opportunity to make sure that relevant results are being returned. Only posts and pages that have been indexed by Google will appear in the search results.
Once you have made sure that you are satisfied with the results, it is time to move onto the next step.
3. Extract the Search Engine Unique ID
On the subsequent page, you will be presented with a text box full of code. We are only interested in extracting the search engine unique ID, highlighted below:
If you are in any doubt as to whether or not you have the correct ID, you can also find it by accessing your search engine’s control panel on this page.
Once you have extracted the ID, head over to the Google Custom Search plugin’s settings screen and paste it into the relevant box:
Hit “Save Changes”, and the setup process is complete!
4. Create Your Search Box
The final step is of course to create a search box. You have two options.
The first is to create it in widgetized area, simply by dragging and dropping the “Google Custom Search” widget.
The second is to include the search box anywhere in your blog’s theme by pasting the following PHP code:
<?php display_search_box($display_results_option); ?>
You need to replace $display_results_option with one of the following:
- display_results_as_pop_up – this displays the results in a lightbox on the page
- display_results_in_under_search_box – this displays the results directly under the search box
- display_results_custom – this display the results in a specified location
If you choose display_results_custom, you need to stipulate where the results should be displayed by entering the following PHP code in the desired location:
<?php display_gsc_results(); ?>
Congratulations! You now have Google Custom Search on your WordPress blog.
Although the Google Custom Search plugin is an extremely straightforward solution, it may not be to your liking. You may in fact want to integrate search results into your theme’s template, rather than returning the results in a lightbox:
It certainly is possible to do this – if you have a rudimentary understanding of PHP and an hour or so to spare, just follow this excellent guide.
If on the other hand you want a quick and easy alternative to WordPress’ default search engine, Google Custom Search is a fantastic option.
What Do YOU Use?
There is no doubting the importance of search in increasing the usability of your website. With that in mind, what tool do you currently use? Have you been using WordPress’ default search engine, and if so, are you now going to make the switch? Or do you use one of the many alternatives and prefer it to Google Custom Search? Let us know in the comments section!