今天北京又下起了纷纷扬扬的雪,楼宇间、道路上无不弥漫着一片亮白色。
阅读全文 »当把博客或者说个人网站部分CMS化变的越来越流行的时候,输出特定的内容就显得特别重要。 譬如我的博客的热门分类的输出,如果你满足于输出某单项分类,仅仅需要在代码中添加下面的语句 1 2 3 4 5 6 7 <?php $cat_str=你想输出的ID内容; query_posts("showposts=3&cat=".$cat_str); while(have_posts()):the_post(); //这里输出你自己构造的内容 endwhile; ?> 但是如果你想实现如文章附图中的效果,似乎就需要采取数组了。 1 2 3 4 5 6 7 <?php $cat_str = join(",",$你的分类数组); query_posts("showposts=3&cat=".$cat_str); while(have_posts()):the_post(); //这里输出你自己构造的内容 endwhile; ?>
阅读全文 »最近在完善主题,发现中文截断还是有点小问题。改进一下。放在这里以后似乎还能用吧? <?php function the_content_strip($content,$len) { $content = preg_replace(’@<!– ]*?>.*? // –>@si’, ”, $content); $content = preg_replace(’@<!– ]*?>.*? –>@si’, ”, $content); $content = mb_strimwidth($content,0,$len,’…’,'utf-8′); $content = strip_tags($content); return $content; } ?>
阅读全文 »![[随笔]认真的雪](http://cache.promiseforever.com/wp3/images/image_shadow.png)
![[PHP]用数组帮WordPress确定输出特定分类的文章](http://cache.promiseforever.com/wp/images/image-628x250-1-/wp-content/uploads/2010/03/2010-03-03_140354.jpg.jpg)