请教大胡子wpjam_get_post_first_image
function wpjam_get_post_first_image($post_content='', $size='full'){
if(!$post_content){
$the_post = get_post();
$post_content = $the_post->post_content;
}
preg_match_all( '/class=[\'"].*?wp-image-([d]*)[\'"]/i', $post_content, $matches );
if( $matches && isset($matches[1]) && isset($matches[1][0]) ){
$image_id = $matches[1][0];
if($image_url = wpjam_get_post_image_url($image_id, $size)){
return $image_url;
}
}
preg_match_all('|
3条回复
我要回复
暂时不支持网页回复,请安装