WordPress views 用来查看文章读取数的插件。由lesterchan开发。发表的文章只有回复数显示,谁都知道很多人是潜水的,看文章从来不回复,那么我想知道有多少人看过我的文章怎么办呢? WordPress自身没有这个功能,只好借助于一款强大的插件:PostViews,目前最新的版本是1.40。
跟其他的所有插件一样,只需要将解压后的文件夹整个上传至/wp-content/plugins/下面,然后再将其激活就算安装成功。
- Open wp-content/themes/<YOUR THEME NAME>/index.phpYou may place it in single.php, post.php or page.php also.
- Find:
<?php while (have_posts()) : the_post(); ?>
- Add Anywhere Below It:
<?php if(function_exists('the_views')) { the_views(); } ?> - Go to 'WP-Admin -> Settings -> Post Views' to configure the plugin.
- Activate WP-PostViews Widget Plugin
- Go to 'WP-Admin -> Appearance -> Widgets'
- To Display Most Viewed Post
- You can add the Most Viewed Widget by clicking on the 'Add' link besides it.
- After adding, you can configure the Most Viewed Widget by clicking on the 'Edit' link besides it.
- Click 'Save Changes'
- To Display Least Viewed Posts
- Use:
<?php if (function_exists('get_least_viewed')): ?> <ul> <?php get_least_viewed(); ?> </ul> <?php endif; ?>The first value you pass in is what you want to get, 'post', 'page' or 'both'.
The second value you pass in is the maximum number of post you want to get.Default: get_least_viewed('both', 10);
- To Display Most Viewed Posts
- Use:
<?php if (function_exists('get_most_viewed')): ?> <ul> <?php get_most_viewed(); ?> </ul> <?php endif; ?>The first value you pass in is what you want to get, 'post', 'page' or 'both'.
The second value you pass in is the maximum number of post you want to get.Default: get_most_viewed('both', 10);
- To Display Least Viewed Posts For A Category
- Use:
<?php if (function_exists('get_least_viewed_category')): ?> <ul> <?php get_least_viewed_category(); ?> </ul> <?php endif; ?>The first value you pass in is the category id.
The second value you pass in is what you want to get, 'post', 'page' or 'both'.
The third value you pass in is the maximum number of post you want to get.Default: get_least_viewed_category(1, 'both', 10);
- To Display Most Viewed Posts For A Category
- Use:
<?php if (function_exists('get_most_viewed_category')): ?> <ul> <?php get_most_viewed_category(); ?> </ul> <?php endif; ?>The first value you pass in is the category id.
The second value you pass in is what you want to get, 'post', 'page' or 'both'.
The third value you pass in is the maximum number of post you want to get.Default: get_most_viewed_category(1, 'both', 10);
- To Sort Most/Least Viewed Posts
- You can use:
<?php query_posts('v_sortby=views&v_orderby=desc') ?>Or pass in the variables to the URL:
http://yoursite.com/?v_sortby=views&v_orderby=desc
You can replace desc with asc if you want the least viewed posts.
有点相关的文章
- 修改DB Cache Reloaded兼容WP-PostViews的方法 (0.953)
- WPCleaner-删除修订版或草稿,减小空间 (0.548)
- 为你的wordpress添加留言本(两种方法) (0.548)
- WordPress分页插件之Pagebar2 (0.548)
- [WP插件]MiaoGzip v1.0-节约带宽,提高速度 (0.548)
- 博客关键词链接插件,完美支持中文和英文关键词 (RANDOM - 0.500)







这插件很好,没想到这儿这么多好东西
[回复]
插件很好,就是不会用,也看不明白博主写的用法
[回复]
好评
[回复]
很好啊,学习了
[回复]
一如即往的支持~~~
[回复]
支持柳城
[回复]
It is corporeal pleasure to know you blog!
[回复]
呵呵,正在找这个东东,谢谢楼主的分享
[回复]
WP确实有很多地方需要研究啊
[回复]
每次来都有收获啊
[回复]
It’s so lucky for me to find your blog! So shocking and great!Thanks for your
information!It is a good post i think!caiyifang/comment201110
[回复]