scriptygoddess

04 Jul, 2004

Google Hi-Lite fix

Posted by: Jennifer In: WordPress Hacks

Peggy emailed me about a problem I was having on this site with the Google Hi-Lite plugin that's included with 1.2. She did all the searching to find the fix the problem (which was posted on huddledmasses.org here ) (So all credit for finding this goes to her) Certain searches (I think ones that contain a backslash – you know how WP eats these for breakfast) 😉 will cause errors on the page.

Here's what you need to do to fix it. Look for these lines (should be Orig lines 104, 105, 106, 107)

if (!preg_match('/<.+>/',$text)) {
$text = preg_replace('/(b'.$term.'b)/i','<span
class="hilite">$1</span>',$text);
} else {
$text = preg_replace('/(?<=>)([^<]+)?(b'.$term.'b)/i','$1<span
class="hilite">$2</span>',$text);

Change those lines to this:

if (!preg_match('«<.+>«',$text)) {
$text = preg_replace('«(b'.$term.'b)«i','<span
class="hilite">$1</span>',$text);
} else {
$text = preg_replace('«(?<=>)([^<]+)?(b'.$term.'b)«i','$1<span
class="hilite">$2</span>',$text);

No Responses to "Google Hi-Lite fix"

Comments are closed.

Featured Sponsors

Genesis Framework for WordPress

Advertise Here


  • Scott: Just moved changed the site URL as WP's installed in a subfolder. Cookie clearance worked for me. Thanks!
  • Stephen Lareau: Hi great blog thanks. Just thought I would add that it helps to put target = like this:1-800-555-1212 and
  • Cord Blomquist: Jennifer, you may want to check out tp2wp.com, a new service my company just launched that converts TypePad and Movable Type export files into WordPre

About


Advertisements