Yes, I can see what's happening now. This Modern vanilla code:
osc_highlight( strip_tags( osc_premium_description() ) )
really doesn't need to include function strip_tags, because osc_highlight() already includes it. Then the solution is to clone osc_highlight() and modify it a little to not apply strip_tags.
Add this at the very bottom of your
theme functions.php (take care not to leave blank lines after this):
<?php
/**
* Gets prepared text, with:
* - higlight search pattern and search city
* - maxim length of text
* - Preserve HTML tags (teseo's mod)
*
* @param string $txt
* @param int $len
* @param string $start_tag
* @param string $end_tag
* @return string
*/
function cust_highlight($txt, $len = 300, $start_tag = '<strong>', $end_tag = '</strong>') {
// $txt = strip_tags($txt); // Only difference with cloned core helper osc_highlight()
$txt = str_replace("\n", ' ', $txt);
$txt = trim($txt);
if( mb_strlen($txt, 'utf8') > $len ) {
$txt = mb_substr($txt, 0, $len, 'utf-8') . "...";
}
$query = osc_search_pattern();
$query = str_replace(array('(',')','+','-','~','>','<'), array('','','','','','',''), $query);
$query = str_replace(
array('\\', '^', '$', '.', '[', '|', '?', '*', '{', '}', '/', ']'),
array('\\\\', '\\^', '\\$', '\\.', '\\[', '\\|', '\\?', '\\*', '\\{', '\\}', '\\/', '\\]'),
$query);
$query = preg_replace('/\s+/', ' ', $query);
$words = array();
if(preg_match_all('/"([^"]*)"/', $query, $matches)) {
$l = count($matches[1]);
for($k=0;$k<$l;$k++) {
$words[] = $matches[1][$k];
}
}
$query = trim(preg_replace('/\s+/', ' ', preg_replace('/"([^"]*)"/', '', $query)));
$words = array_merge($words, explode(" ", $query));
foreach($words as $word) {
if($word!='') {
$txt = preg_replace("/(\PL|\s+|^)($word)(\PL|\s+|$)/i", "$01" . $start_tag . "$02". $end_tag . "$03", $txt);
}
}
return $txt;
}
?>
Then you replace in Modern
search-list.php:
osc_highlight( strip_tags( osc_premium_description()) )
and
osc_highlight( strip_tags( osc_item_description()) )
with
cust_highlight( osc_premium_description() )
and
cust_highlight( osc_item_description())
Try and see if it doesn't need some other adjustment.
Regards