Reply To: search

#6335
Ernest Marcinko
Ernest Marcinko
Keymaster

The problem with your request is that you want to highlight the term on the actual single result page, not on the search results page, that’s a very big difference. I highly doubt any of these solutions will be helpful in this case.

There is a highlighter in the search included but it only works on the ajax results not on the actual results page.

One solution might be to pass an extra get parameter with the search results url. It is possible to change the result url wihtout changin the code using the proper filter, here is an example: https://wp-dreams.com/knowledge-base/how-to-change-the-results-url-to-something-else/
So like adding an extra parameter, something like:

$results[$k]->link .= “?highlight=” . $search_phrase;

But then again the $search_phrase variable is not defined, so you will have to somehow get it there, I don’t know how.

Then with another filter you will have to change the content or connect with the highlighter plugin somehow, because now the

$_GET[‘highlight’]

variable contains the highlightable phrase.

But then again, that’s just a suggestion from the top of my head. This is way beyond the plugin capabilities. I can give you suggestions or help, but I’m afraid I can’t solve this for you right now.

Best,
Ernest Marcinko

If you like my products, don't forget to rate them on codecanyon :)