关心大家 在线客服手机微信
在线客服 0030
北京市:
2、在前台接待启用明确好的照片:选用涵数的方式還是立即启用照片。
完成以下:
前提条件:
一切启用最好全是在LOOP循环系统中,那样能够轻轻松松的应用$post值。
preg_match('/ img.+src=[\'\"]([^\'\"]+)[\'\"].* \/ /i',$post- post_content,$index_piclink);
if(count($index_piclink) = 2)$image_src = $index_piclink[1];
if(!strstr($image_src,'p>
2、启用一个自定频道:在发表文章的情况下,提升一个名词为post_thumb的自定频道,随后将照片的详细地址做为值创建它。如meta_key:post_thumb,meta_value:images/logo.png,随后根据下列的方式启用它:
$image_src = '';
if(function_exists('has_post_thumbnail') has_post_thumbnail()){
$image_id = get_post_thumbnail_id();
$image_src = wp_get_attachment_image_src($image_id,$size);
$image_src = $image_src[0];
}else{
$image_src = get_post_meta($post- ID,'post_thumb',$single=true);
if(!$image_src $first_pic_in_ctonte){
preg_match('/ img.+src=[\'\"]([^\'\"]+)[\'\"].* \/ /i',$post- post_content,$index_piclink);
if(count($index_piclink) = 2)$image_src = $index_piclink[1];
if(!strstr($image_src,'p>
}
}
return $image_src;
}
function the_thumb_src($size = 'thumbnail',$first_pic_in_ctonte = true){
echo get_thumb_src($size,$first_pic_in_ctonte);
}