WP-PostViews使用

1.在后台安装次插件

2.获取多少天之内的访问排名最高的记录

2.1 添加相应方法代码到wp-postviews.php文件中,据体代码可以网上找(本人自己可以在自己本机的例子查看到),这里只是记录大概步骤。

2.2 把这个方法用到你要用的地方,如

<div id="sidebar" role="complementary">

<li><h2>排行</h2>  

<ul>     

<?php  if(function_exists('get_timespan_most_viewed')): ?>     <?php get_timespan_most_viewed('post',8,'1000000', true);?>       <?php endif; ?>                

</ul>    

</li>

 </div>

 其中那个1000000代表的是你多少天内发布的文章,比如说你这里,只想显示你30天内发布文章游览最多的前8条,那样只要把这个数字改成30就可以了。

原文地址:https://www.cnblogs.com/scottpei/p/3223292.html