Here is my first attempt at cleaning up, but unfortunately it doesn’t seem to work like o our genesis site.
function custom_post_thumb_image($thumb_img_url) {
if ($thumb_img_url == "") {
global $post;
ob_start();
ob_end_clean();
$output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
if (!empty($matches) && isset($matches[1][0])) {
$thumb_img_url = $matches[1][0];
}
}
if(empty($thumb_img_url)) {
if (preg_match('%(?:youtube(?:-nocookie)?\.com/(?:[^/]+/.+/|(?:v|e(?:mbed)?)/|.*[?&]v=)|youtu\.be/)([^"&?/ ]{11})%i', $post->post_content, $match)) {
$thumb_img_url= 'http://i3.ytimg.com/vi/'.$match[1].'/0.jpg';
}
}
return $thumb_img_url;
}
add_filter( 'sf_post_thumb_image_url', 'custom_post_thumb_image' );
possibly you might see the issue in the code. Needs fresh eyes I think.