Thread Starter
bufny
(@bufny)
my own solution:
in the get_the_image_by_scan function, just after preg_match_all call:
$search_query = get_search_query();
if (isset($matches) && !empty($search_query)) {
$full_image_tags = $matches[0];
$src_image_tags = $matches[1];
foreach ($full_image_tags as $index => $full_image_tag) {
if (stripos($full_image_tag, $search_query) !== FALSE) { // just return 1st match to the search_query
return array('src' => $src_image_tags[$index]);
}
}
}