Posted By

newsok on 10/26/10


search wordpress highlight

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Enlight search results in your WordPress blog

 / Published in: PHP

Open your search.php file and find the the_title() function. Replace it with the following:

1.echo $title;

Save the search.php file and open style.css. Append the following line to it: { background: yellow; }

  1. <?php
  2. $title = get_the_title();
  3. $keys= explode(" ",$s);
  4. $title = preg_replace('/('.implode('|', $keys) .')/iu',
  5. '<strong class="search-excerpt">\0</strong>',
  6. $title);
  7. ?>

Report this snippet  


RSS Icon Subscribe to comments
Posted By: on August 31, 2018

how to android root coolpad 3632a

You need to login to post a comment.