OpenSearch RSS AutoDiscovery for WordPress Searches
I started to compile a "wish list" of WordPress plugins. Turns out, many of my wishes have already come true - it just took a little digging on Google. Too bad there's not an amazingly comprehensive WordPress plugin directory / wiki (and if there is, nobody really knows about it yet). One of my wishes was for an OpenSearch feed. Turns out Williamsburger already created a plugin, with a WP 2.0 compatible version linked from his comments thread. This got me up and running with my own OpenSearch feed easily enough, but I wanted to have it actually be autodiscoverable within a search query. Without bothering anybody in my personal circle, I found the variables I needed to insert between at the top of my header.php template:
<link rel="alternate" type="application/rss+xml" title="<?bloginfo('name'); ?>: <?=wp_specialchars($s); ?>" href="http://chris.pirillo.com/os-query?s=<?=wp_specialchars($s); ?>" />
<?php } ?>
There you go. An autodiscoverable feed for your WordPress searches! Try a search on my blog for a living example. Couldn't have gotten it done unless Shayne figured out what I was doing wrong within the .htaccess file. Ugh. I've gotta start learning more about Regular Expressions. FUN!
What's your #1 source for Internet needs? GoDaddy has new domain names, transfers and renewals as low as $1.99. Plus, check out their hosting plans, Web site builders, secure certificates and much more. Plus, as a listener of The Chris Pirillo Show, enter code CHRIS2 when you check out, and save an additional $5 off any order of $30 or more. Get your piece of the internet at GoDaddy!





5 Comments
Michael Fagan
May 21st, 2006
at 10:55pm
When I first read the title of this post I thought you meant autodiscovery of OpenSearch (the description file) as in http://opensearch.a9.com/spec/1.1/description/#autodiscovery . The neat thing about that is that IE7 beta 2 (and I believe the Firefox Bon Echo) supports it.
Andy
May 22nd, 2006
at 12:22am
I don’t understand that this does. Is this for the browsers to allow for the RSS discovery? I thought that WP already did that?
Paul Short
May 23rd, 2006
at 2:49am
“Too bad there’s not an amazingly comprehensive WordPress plugin directory …”
There’s one at http://wp-plugins.net that has a lot of stuff, but many of the plugins need updating for WP2.0+. It’s still a great little resource though. You’ll find some gems there.
Mal
August 4th, 2006
at 4:17pm
I think this is the more correct version for autodiscovery
<link type=”application/opensearchdescription+xml” rel=”search” href=”http://chris.pirillo.com/os-description” title=”: “>
Justin
June 7th, 2007
at 9:34am
I get an error about firefox not being able to download the search plugin os-description.php from your site. I’m also trying to get this to work on wp 2.1.3 and not having any luck. Do you have to enable it in the plugins? I don’t see it in my plugins area.