function thumb_img($soContent){
$soImages = '~<img [^\>]*\ />~';
preg_match_all( $soImages, $soContent, $thePics );
$allPics = count($thePics[0]);
if( $allPics > 0 ){
echo "<span id='thumb'>";
echo $thePics[0][0];
echo '</span>';
}
else {
echo "<span id='thumb'>";
echo "<img src='";
echo bloginfo('template_url');
echo "/images/thumb.gif'></span>";
}
}
thumb_img($post->post_content);
#thumb{margin:5px 15px 5px 5px;width:145px;height:120px;border:3px solid #eee;float:left;overflow:hidden;}
#thumb img{max-height:186px;max-width:186px}
以上就是安达网络工作室关于《WordPress简单三步实现首页文章显示缩略图(无插件)》的一些看法。更多内容请查看本栏目更多内容!
WordPress 3.0 引入导航菜单性能, 让页面的导航和链接的治理变得简略易用. WP 向用户提供了菜单治理页面和多...
4月更新过文章,文章ID停留在146,5月忙于考试,文章一篇都没写,后果6月前几天写文章的时分,ID从146间接跳...
本文实例讲述了wordpress晋级后明码正确后盾无奈登陆的处理办法。分享给大家供大家参考。详细剖析如下: 明...
比方, 一个做音乐的网站一定不心愿搜寻引擎收录它的存档月份, 由于没有人会经过这个来搜寻出去. 这咱们就能...
WordPress模板的定义十分不便,然而在定制模板之前,咱们有必要晓得WordPress的模板层次,理解WordPress是如...
在以前的代码中,咱们仅仅应用add_shortcode函数来把短代码注册到wordpress中,在文章页应用the_content来显...