Search term highlighting on my site

Keith posted about his efforts to highlight Google search terms. This is interesting! I may be able to create a b2-prefunction that does the same for b2++.
Update! I modified my original highlightsearch() function, adding in most of the code found on which also fixes the problem of highlighting text inside html links! Woo!
Here’s a Google search for you to try. Hit the Holy Shmoly link to see the highlighted text!
Again, if you want to add this to your own blog, just edit post.tpl add add the highlightsearch modifier around $the_content:


You’ll then have access to lots of highlighted search results!

By Donncha

Donncha Ó Caoimh is a software developer at Automattic and WordPress plugin developer. He posts photos at In Photos and can also be found on Twitter.

Leave a Reply