Home / Marketing Videos / Replace WordPress Search with Google Custom Search
Google Custom Search Engine Results

Replace WordPress Search with Google Custom Search

Let’s face it, WordPress Search is slow and very innaccurate. Thankfully, Google is both blazing fast and accurate. In addition, Google’s Google Custom Search has evolved to be embedded into your own blog (or web site).

Permalinks and Google Custom Search

For a site with permalinks like mine, I did have to make one additional modification, though. I had to make the action in the form tag relative rather than supplying the entire URL with domain.

<form action="/query/"...

Google Custom Search has another nice feature… it will pull the featured image if your site is utilizing them and you have optimized headers using microdata in accordance with schema.org. I utilize the Yoast WordPress SEO plugin to take care of that – and my site is updated with featured images for each post.

Make a Search Result Page Template

Rather than hacking up your theme or messing with embedded Javascript in your page content, I’d also recommend building a template for the Google Custom Search Results Page. To do this, simply build a page that’s structured like your Single Page theme page. Gut all the chunks you don’t need and insert the Google code. Add a page to your template and call it something like googlecse.php with the following code within it:

<?php
/* Template Name: Google Custom Search Results */
get_header(); ?>
<div id="content">
<div class="post">
<h3>Search Results:</h3>
[ Insert your Google Custom Search Results Code Here ] </div></div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>

Now, when you add a new page for your results, select this as the template:

I wouldn’t hesitate at doing this to any blog – not just for the blazing improvement in speed but also for the relevant results. You may even make a couple bucks on the side as well! Take a look for yourself and give my new Search form for a spin! You won’t be disappointed!

One note: If you’re running a theme like the Twenty Eleven theme, you’ll need to update the search field css with !important on each of the query field styles so that you maintain the look and feel! You will also need to hard-code the iframe CSS width in your style sheet (optionally setting the width within the JavaScript appears to have no impact).

Free Online SEO Audit

Utilize our free SEO audit tool to identify issues and optimize your site, landing page or blog post:

About Douglas Karr

Douglas Karr is the founder of The Marketing Technology Blog. Doug is the CMO of CircuPress and CEO of DK New Media, an agency specializing in assisting marketing technology companies with their inbound marketing - leveraging social media, blogging, search engine optimization, pay per click and public relations. Their clients include Angie's List, GoDaddy, Mindjet and many more. Douglas is also the author of Corporate Blogging for Dummies.

Check Also

Mobile Video

Mobile Video Ads Are About The Story Without The Sale

Google just released the results of a new experiment that’s quite impressive and should be ...

One comment

  1. I’ve had Google Custom Search on my blog for a long time now. However, I keep both options open.

Leave a Reply