On Creating an OpenSearch Plug-in for WordPress (for Firefox & IE7)

 

In my earlier tutorial titled Creating OpenSearch Plugins for Firefox (adds to the QuickSearch bar) I taught you how to write a basic OpenSearch XML format plug-in that can be used with both Firefox 2.x and IE7. The demonstrated example consisted of creating a plug-in that searches through Invision Power Boards.

As an afterthought, I felt like coming up with another quick tutorial on creating the same for WordPress. I won’t spend any time on explaining the components of the plug-in and hence you’re advised to go through the tutorial first before continuing with this. This post is merely an example of how-to modify the code shown earlier on to perform searches on WordPress.

If you ever notice the URL in the address bar when you perform searches using the internal search engine of WordPress, you’ll find the the index.php page is being called along with a variable called “s“, which contains the keywords. Say for instance, you are searching for the term “Firefox” .. the syntax will be …
[html]
http://www.domain.com/index.php?s=Firefox
[/html]

If you refer to the tutorial you’ll see that we can pass on variable-value combinations to a URL using the Param tags. That’s the only parameter you need to pass for WordPress searches. I’ll cite the XML code of my site’s plug-in as an example. It should be self-explanatory.

[xml]
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
ChaosLab
Chaos Laboratory: Blog Search
miCRoSCoPiC^eaRthLinG
microscopic.earthling@gmail.com
open
false
en-us
UTF-8

UTF-8
http://www.chaos-laboratory.com/favicon.ico


http://www.chaos-laboratory.com/index.php

[/xml]

Notice, how I’m passing the keywords in the form of the dynamic variable {searchTerms}.

Any questions ??

Seems like no one has left a comment yet. Why don't you be the first one?

Leave a Reply (Fields marked with a * are required.)