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简单三步实现首页文章显示缩略图(无插件)》的一些看法。更多内容请查看本栏目更多内容!
装置SAE上的wordpress,创立使用抉择wordpress模板,装置后是3.4版本 新建一个版本2,下载最新wordpress装置...
本文实例讲述了wordpress主题评论中增加回复的办法。分享给大家供大家参考。详细如下: 很多冤家要给本人主...
get_header()(获取头部) 引入主题的头部模板,默许会引入以后主标题录里的 header.php 文件。假如指定了一...
本文实例讲述了WordPress后盾删除不需求的侧边栏菜双方法。分享给大家供大家参考。 详细完成办法是在以后主...
post_class() post_class 是 WordPress 内置的一个用于显示文章 class 称号的函数,该函数通常会为每一篇文...
WordPress模板根本文件 复制代码代码如下:style.css 款式表文件index.php 主页文件single.php 日志单页文件...