WordPress插件wp-postviews使用方法

用了很久的插件,总结一下代码调用的方法:
阅读次数:< ?php if(function_exists('the_views')) { the_views(); } ?>

1、显示阅读次数最多的文章或页面

&lt; ?php if (function_exists('get_most_viewed')): ?&gt;
&lt; ?php get_most_viewed(); ?&gt;
&lt; ?php endif; ?&gt;

如果你只想显示越多次数最多的文章,用下面这句

&lt; ?php if (function_exists('get_most_viewed')): ?&gt;
&lt; ?php get_most_viewed('post'); ?&gt;
&lt; ?php endif; ?&gt;

如果你只想显示10篇阅读次数最多的文章,用下面的代码

&lt; ?php if (function_exists('get_most_viewed')): ?&gt;
&lt; ?php get_most_viewed('post',10); ?&gt;
&lt; ?php endif; ?&gt;

get_most_viewed 函数的第一个参数决定要显示的类别,可选 post ,page,both,第二个参数决定要显示的篇数。
如果你想显示显示某类别下的阅读次数最多的文章,用下面这段

&lt; ?php if (function_exists('get_most_viewed_category')): ?&gt;
&lt; ?php get_most_viewed_category(the_catagory_ID(false)); ?&gt;
&lt; ?php endif; ?&gt;

get_most_viewed_category函数有三个参数,第一个值是类别ID,第二个值是类别,可选both,page,post,第三个值决定要显示的篇数。
例如:显示分类ID为3下面阅读次数最多10篇文章

get_most_viewed_category(3, 'post', 10);