Home / search / Firefox opensearch and your blog
  • How to Firefox opensearch and your blog

    firefox-opensearch-and-your-blog

    Add this code to a text editor and save as opensearch.xml then upload to your root dir. This will let users add your website as a search engine within Firefox like Google, Bing, Wikipedia and others. Now visitors can change their search option and select your blog.

    ( click code to copy )

    wordpress snippet : PHP

    <>
    <?xml version="1.0" encoding="utf-8"?>
    <OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/">
      <ShortName>wpsnipp.com (code search)</ShortName>
      <Description>Search wordpress code snippets</Description>
      <InputEncoding>UTF-8</InputEncoding>
      <LongName>WP Snipp Search</LongName>
      <Image height="16" width="16" type="image/x-icon">http://wpsnipp.com/favicon.ico</Image>
      <Url type="text/html" method="get" template="http://wpsnipp.com/?s={searchTerms}"/>
    </OpenSearchDescription>
    

    Update

    Thanks to Dale pointing out I was missing this part, I completely forgot apparently. Yikes. Place the snippet of HTML into the header.php of your wordpress theme.

    ( click code to copy )

    wordpress snippet : HTML

    <>
    <link title="wpsnipp.com - Search" type="application/opensearchdescription+xml" rel="search" href="http://wpsnipp.com/opensearch.xml">
    

    ( WordPress codex functions, hooks, in this snippet. )

    template, wp,
  • Seems you also need to add the following to your themes header.php, in order to get Firefox to recognise the opensearch.xml file…

    Once added you can then select your site as a search plugin like Google, Bing and Wikipedia etc.

    • Whoa, good call Dale I completely forgot to add this in the sample, thanks!