WP-PostView

插件名称:WP-PostView
适用版本:Woprdpress 2.3 或更高
功能: 文章阅读数统计,实现侧边栏 Widget 以及显示最受欢迎文章等功能
下载: WP-PostViews 1.20 For WordPress 2.3.x
一、安装
将解压得到的 postviews 文件夹上传到 /wp-content/plugins 文件夹中
激活插件
二、使用
修改 index.php :
<?php while (have_posts()) : the_post(); ?>
将下面的语句添加到如何需要的地方
<?php if(function_exists(’the_views’)) { the_views(); } ?>

登录“WP-Admin -> 设置 -> Post Views”可以配置该插件
Count Views From 设置统计对象
Views Template 显示样式
Postviews

调用:
1、显示最受欢迎(阅读次数最多)文章,使用下面语句
<?php if (function_exists(’get_most_viewed’)): ?>
<?php get_most_viewed(); ?>
<?php endif; ?>

显示某个分类下最受欢迎(阅读次数最多)文章
<?php if (function_exists(’get_most_viewed_category’)): ?>
<?php get_most_viewed_category(); ?>
<?php endif; ?>


5条评论 so far
Leave a comment

我的POSTVIEW还是不会用啊 代码要怎么加啊 麻烦说详细点 谢谢

< ?php if(function_exists(’the_views’)) { the_views(); } ?>把上面这段代码放到你希望显示的地方,一般放index.php和single.php,

index.php里有很多行代码啊 加哪行里啊
我加
后面 可是还是不行啊 没反应 是不是我主题有问题
还是加错行了

主页显示上多了行
是不是加错地方了

< ?php if(function_exists('the_views')) {the_views();} ?>

把上面这行代码贴到你想显示的地方,比如作者啊或者日期后面就可以了,一般习惯放在文章标题下面.注意,?前的空格去掉.



发表评论
自动换行分段,电子邮箱地址不会被公开。允许使用 HTML 标签: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

(必填)

(必填)