用了很久的插件,总结一下代码调用的方法:
阅读次数:< ?php if(function_exists('the_views')) { the_views(); } ?>
1、显示阅读次数最多的文章或页面
< ?php if (function_exists('get_most_viewed')): ?> < ?php get_most_viewed(); ?> < ?php endif; ?>
如果你只想显示越多次数最多的文章,用下面这句
< ?php if (function_exists('get_most_viewed')): ?> < ?php get_most_viewed('post'); ?> < ?php endif; ?>
如果你只想显示10篇阅读次数最多的文章,用下面的代码
< ?php if (function_exists('get_most_viewed')): ?> < ?php get_most_viewed('post',10); ?> < ?php endif; ?>
get_most_viewed 函数的第一个参数决定要显示的类别,可选 post ,page,both,第二个参数决定要显示的篇数。
如果你想显示显示某类别下的阅读次数最多的文章,用下面这段
< ?php if (function_exists('get_most_viewed_category')): ?> < ?php get_most_viewed_category(the_catagory_ID(false)); ?> < ?php endif; ?>
get_most_viewed_category函数有三个参数,第一个值是类别ID,第二个值是类别,可选both,page,post,第三个值决定要显示的篇数。
例如:显示分类ID为3下面阅读次数最多10篇文章
get_most_viewed_category(3, 'post', 10);