-
-
Save anonymous/df50e543677392ab60cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function easyrotator_update_search_content($content) | |
{ | |
if (is_search()) | |
{ | |
$content = preg_replace_callback('|(<!-- Begin DWUser_EasyRotator -->)(.*?)(<!-- End DWUser_EasyRotator -->)|si', 'easyrotator_update_search_content_callback', $content); | |
} | |
return $content; | |
} | |
function easyrotator_update_search_content_callback($matches) | |
{ | |
$content = $matches[2]; | |
preg_match('|<img.*?\ssrc="([^"]+)".*?/?>|si', $content, $submatches); | |
return $matches[1] . $submatches[0] . $matches[3]; | |
} | |
add_filter('the_content', 'easyrotator_update_search_content', 1000); | |
add_filter('the_excerpt', 'easyrotator_update_search_content', 1000); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment