Ready to get started?Download WordPress

Plugin Directory

Highlight Search Terms

Very lightweight jQuery script that wraps search terms in an HTML5 mark tag when referer is a search engine or within wp search results.

I do not see any highlighting!

This plugin has no configuration options page and there is no predefined highlight styling. For any highliting to become visible in browsers that do not support HTML5 like Internet Explorer 8 or older, you have to complete step II of the installation process. Edit your themes Stylesheet (style.css) to contain a rule that will give you exactly the styling that fits your theme.

Don't want to edit your themes stylesheet? I can highly recommend Automattics own Custom CSS plugin!

I want to customise the highlighting but have no idea what to put in my stylesheet. Can you give me some examples?

Sure! See tab Other Notes for instructions and some examples to get you started.

I still do not see any highlighting!

Due to a problem with jQuery's $('body') call in combination with many other scripts (like Google Ads, Analytics, Skype Check and other javascript) in the ever increasingly popular Firefox browser, I have had to limit the script search term wrapping to a particular div instead of the whole document body. I chose div with class "hentry" since that is the most commonly used content layer class in WordPress themes. If that is not available, the script will look for divs #content then #main then #wrapper. However, in your particular theme, none of these divs might be available...

Let's suppose your theme's index.php or single.php has no <div <?php post_class() ?> ... > but wraps the post/page content in a <div id="common" class="content"> ... </div>. You can do two things to solve this:

A. Change your theme and stylesheet so the post/page content div has either class="hentry" or <?php post_class() ?>. TIP: Take a look at how it is done in the Default theme included in each WordPress release. But this might involve some real timeconsuming tinkering with your stylesheet and several theme template files.

B. Change the source of wp-content/plugins/highlight-search-terms/hlst.php so that the array starting on line 55 contains your main content ID or class name. In the above example that can be either '#common', or '.content', where a prefix '#' is used for ID and '.' for class.

C. Switch to a theme that does abide by the current WordPress conventions :)

Requires: 2.3 or higher
Compatible up to: 3.8.3
Last Updated: 2013-12-13
Downloads: 29,795


4 stars
4.6 out of 5 stars


Got something to say? Need help?


Not enough data

0 people say it works.
0 people say it's broken.

50,4,2 100,3,3
100,1,1 67,6,4
100,3,3 100,1,1 100,2,2
100,2,2 100,1,1
100,1,1 100,1,1
100,1,1 100,2,2
100,1,1 100,2,2
0,1,0 100,1,1