OpenSearch-enabling your blog

January 30th, 2009. Tagged: WordPress

Have you noticed when you visit some sites, there's a bluish glow in the search engine field in Firefox. Like this:

open search example firefox

What does that even mean? Well, it means you can add this site's search to the drop down list of search engines. This functionality is following the open search standard.

The things are actually pretty simple. You need to have an XML file <link>-ed to from your page.

For example on this blog I have this in the head:

<link 
  rel="search" 
  type="application/opensearchdescription+xml" 
  href="http://www.phpied.com/wp-content/plugins/open-search/open-search-xml.php" 
  title="phpied.com : Search in posts"
/>

So how do you add open search capability to your blog? With the OpenSearch plugin for WordPress, naturally.

BTW, if you're running PHP4 you might get errors during installation, in this case just open up the open-search-class.php and

  • replace all "public static" with empty string
  • replace all "private static" with empty string
  • replace all "self::" with "OpenSearch::"

This is it, enjoy and if you want to change the default icon, you need to look into replacing the image found in /wp-content/plugins/open-search/default-favicon.png

Here's what you get at the end:

And now your readers can add your search to their browser and quickly find content on your blog. Sweet.

Tell your friends about this post: Facebook, Twitter, Google+

Sorry, comments disabled and hidden due to excessive spam. Working on restoring the existing comments...

Meanwhile, hit me up on twitter @stoyanstefanov