Das erste Bild eine WordPress Postings extrahieren
Diese PHP Funktion ermöglicht das Extrahieren des ersten Bilds eines WordPress Beiträge.
function get_image_src($posti = null) {
if (!$posti)
global $post;
else
$post->post_content = $posti;
$the_content = $post->post_content;
$muster = '!<img.*?src="(.*?)"!';
preg_match_all($muster, $the_content, $treffer);
$image_src = $treffer['1'][0];
return $image_src;
}