Highlight Search Terms WordPress Plugin

Highlight Search Terms is a WordPress plugin that can highlight search terms on your blog’s search page. The plugin is based on a tutorial by Thaya Kareeson, but it also includes several additional features not present in the tutorial and better browser compatibility.

Features

  • Multiple colors : Each word of the search query is higlighted in a different color, for up to five user-configurable colors. The colors will “wrap around” if there are more than five words in the query, i.e. the sixth keyword will have the same color as the first, and so on.
  • Phrase highlighting : The plugin understands more advanced search queries like “wordpress plugin” screenshot and will treat a quoted phrase as a single search term. See the screenshots below for an example.
  • Browser compatibility : Tested and works in FF 3.0.8, Opera 9.64, Chrome 2.0.173.1 and IE 8. The settings screen is also usable in all of the above, but it works slightly better in FF/Opera.
  • Simple configuration : Just a few boxes and a neat color picker from Eyecon 🙂

Screenshots

The admin interface :
The admin interface

The color picker :
Javascript color picker

To demonstrate how it all looks in action, I searched my test blog for “text classification” php “machine learning” AI spam. Here’s the result :
Search results with search terms highlighted

Download

highlight-search-terms.zip (58 Kb)
Extract the archive and upload it to /wp-content/plugins, preserving directory structure.

Installation

In addition to uploading and activating the plugin, you will also need to tell it where you want the search terms to be highlighted. Go to Settings -> Highlight Search Terms and enter the HTML tag ID of the area that contains the search results. You can find the ID either by examining the HTML source code of your search page or by using a webdesign-oriented Firefox extension like DOM Inspector.

In case you have no idea what the above paragraph means, you could just enter “body” (sans quotes) in the “Content ID” field. This setting will make the plugin highlight the search terms anywhere on the search page, including the sidebar and footer.

Related posts :

11 Responses to “Highlight Search Terms WordPress Plugin”

  1. […] Highlight Search Terms WordPress Plugin – Highlight Search Terms is a WordPress plugin that can highlight search terms on your blog’s search page. The plugin is based on a tutorial b… […]

  2. Stanley says:

    I wonder what kind of effect this has on the bounce %

  3. Miguel says:

    That’s it! Works perfect – thank’s a lot for this great Plugin!

  4. Ant says:

    Hi, after I changed the source code (from #content to #contents), and then change the Content ID in the Settings to the updated one (i.e. #contents), the highlighting doesn’t work anymore. Could you maybe help me with this?

  5. White Shadow says:

    Maybe you have a caching plugin on and the page you’re testing hasn’t been regenerated with the updated theme yet?

  6. Ant says:

    Hi, thanks for your prompt response. I doubt I have a caching plugin (Advanced Category Excluder, Askimet, All in One SEO Pack, Highlight Search Terms, Simple Tags, WP-DBManager only). And I dun get wat u mean by “the page you’re testing hasn’t been regenerated with the updated theme yet”. Any suggestions for me?

  7. Katherine says:

    Hi. Thanks for the plugin – it’s great! But it highlights only post text for me…
    How to make it highlight the titles?

  8. White Shadow says:

    First download the new version I’ve just uploaded (the old 1.0 was buggy). Then set the Content ID in the plugin’s settings to the ID of the HTML element that includes both the post and the title. I can’t be more specific without seeing your blog’s theme.

  9. Lee says:

    Hi

    The plugin is installed, but doesnt want to work.
    My theme is WP – Imagination…

    Lee

  10. White Shadow says:

    This theme is missing the code that allows plugins to add their own style and scripts to your blog. To fix this, open header.php and add the following code above the </head> tag :

    < ?php wp_head(); ?>

    Then open footer.php and add this code above the </body> tag :

    < ?php wp_footer(); ?>

    Finally, go to Settings -> Highlight Search Terms and change Content ID to “#contents” (sans quotes). That should do it.

  11. Lee says:

    Thanks
    THat worked perfectly!
    Great little plugin!

Leave a Reply