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 …

http://www.domain.com/index.php?s=Firefox

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.


	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

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

Any questions ??

Leave a comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.