首页 > 新闻资讯 > 缩略图显示上月最多评论贴

缩略图显示上月最多评论贴

12条评论
标签:
更多

这段代码可以显示上一个月评论最多的日志,属于一段计数型代码,把第一段放在functions.php中,然后再把第二段放在你想显示的文件中,

function most_wps_popular_thumbnail(){
    $current_month = date('n');
    if($current_month==1){ $last_month=12; }else{ $last_month=$current_month-1; }
    $args = array(
	'posts_per_page' => 4,
	'monthnum'       => $last_month,
	'orderby'        => 'comment_count',
     );
    ?>
   <h1>Most popular snippets</h1>
<?php query_posts($args); ?>
<?php  while (have_posts()) : the_post(); ?>
   <a href="<?php the_permalink(); ?>" title="<? the_title(); ?>"><
   ?php the_post_thumbnail( 'thumbnail' ); ?></a>
<? endwhile; ?>
<?
wp_reset_query();
}
第二段
<? most_wps_popular_thumbnail(); ?>

 

* 版权声明:作者WordPress啦! 转载请注明出处。

#1
我擦。这方法好啊。顶你
#2
真不错,这里是个学东西的好地方啊。
#3
不错,去试试。
#4
哇塞 博主还有这样的研究啊 !佩服!
#5
这个功能还没有使用过
#6
能显示出来是最好不过了。
#7
学习了,这是显示在前台的还是后台的?
#8
这样的代码完全不懂 ,可以学习下不
#9
这个不错啊 有没有演示啊
#10
xiao yan 2011 Mbt Shoes Clearance,Official Mbt Shoes Sale Store for Mbt Shoes UK,perfect Cheap Mbt Shoes mens Mbt Shoes Clearance In Black.Mbt Sandals For Men,Free Shipping Mens Mbt Shoes!Shop MBT Tembea Shoes UK Online from MBT koshi Shoes outlet,New MBT Shoes Sale Up to 66% OFF.MBT Ajabu Shoes men's new style MBT Unono Shoes clearance MBT Kimondo Shoes 2011,MBT Bia Shoes wholesale and MBT WL005 Moja Mid Caviar are Top quality MBT Kabisa Shoes online,MBT Tupu Shoes coffe.Mens MBT Bosi Shoes with popular MBT Chapa Shoes.70% discounce MBT Karibu Shoes,buy MBT Imara Shoes,featuring MBT GIL Gil Shoes,find your MBT Vizuri GTX Shoes.Authentic MBT FUABA Shoes is cheap from MBT Karani Shoes boy,Newsest MBT Lami Shoes online.MBT M.Walk Shoes for men,MBT Shuguli GTX Shoes store.Our MBT Rafiki GTX Shoes shop excellent MBT Sini Shoes belongs MBT Sport 2 Shoes is breathable.MBT Sapatu Shoes is durable.MBT Zuri shoes is the Brand New MBT Tariki Shoes series.Hottest MBT Tataga Shoes here with MBT Fanaka GTX Shoes,noble MBT TaBia Sandals.Fashionable MBT kafala Shoes to worldwide are Original MBT Swala Sandals by ems.Lovely MBT Jawabu Sandals for girls.MBT Pia Sandals Men & Women MBT Kisumu Sandals shoes,kinds of MBT Katika Sandals just cheapest!
#11
这个方法不错 喜欢
#12
这个不错啊