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.
18条回应:“添加文章阅读次数插件:WP-PostViews 1.40详细用法”
这插件很好,没想到这儿这么多好东西
插件很好,就是不会用,也看不明白博主写的用法
好评
很好啊,学习了
一如即往的支持~~~
支持柳城
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
9…
rocking…Yes, the post is very interesting and I really like.It contains many interesting information and i have learned a lot from you .jessonlin/comment/2011nov…
4…
“BanXie” is the ground type of board type shoes. It comes from the skateboard people wear shoes, so also called skateboarding shoes. BanXie compared with general shoes, different place is: it is almost a flat bottom, easy to let feet are able to comp…
To every person whom know what you are, My partner and i wish to say that you all maintain really expensive areas inside my heart. We look into anyone please remember gorgeous along with excitement instances.liulipingcomment201203blog
I will miss those lunatics from Saab, they were different but in a good way. Anyone shares my opinion?masini second hand
这个实现很方便
cn84rtxw4dcwn4xnc4rwif
[…]although websites we backlink to below are considerably not associated to ours, we feel they’re truly worth a go by means of, so have a look[…]
mx38cnt5wdsdxnxe5c7exx
[…]Sites of interest we have a link to[…]