添加文章阅读次数插件:WP-PostViews 1.40详细用法

Posted on 08 六月 2009 by 柳城 ,阅读 722

WordPress views 用来查看文章读取数的插件。由lesterchan开发。发表的文章只有回复数显示,谁都知道很多人是潜水的,看文章从来不回复,那么我想知道有多少人看过我的文章怎么办呢? WordPress自身没有这个功能,只好借助于一款强大的插件:PostViews,目前最新的版本是1.40。

跟其他的所有插件一样,只需要将解压后的文件夹整个上传至/wp-content/plugins/下面,然后再将其激活就算安装成功。

General Usage
  1. Open wp-content/themes/<YOUR THEME NAME>/index.phpYou may place it in single.php, post.php or page.php also.
  2. Find:
    <?php while (have_posts()) : the_post(); ?>
  3. Add Anywhere Below It:
    <?php if(function_exists('the_views')) { the_views(); } ?>
  4. Go to 'WP-Admin -> Settings -> Post Views' to configure the plugin.
View Stats (With Widgets)
  1. Activate WP-PostViews Widget Plugin
  2. Go to 'WP-Admin -> Appearance -> Widgets'
  3. To Display Most Viewed Post
  4. You can add the Most Viewed Widget by clicking on the 'Add' link besides it.
  5. After adding, you can configure the Most Viewed Widget by clicking on the 'Edit' link besides it.
  6. Click 'Save Changes'
View Stats (Outside WP Loop)
  • 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.

转载请注明 : 来源于 添加文章阅读次数插件:WP-PostViews 1.40详细用法 | 柳城

赞助商

13条评论 于 “添加文章阅读次数插件:WP-PostViews 1.40详细用法”

  1. 祛斑产品排行 祛斑产品排行 Says:

    这插件很好,没想到这儿这么多好东西

    [回复]

  2. 风雅联盟博客 风雅联盟博客 Says:

    插件很好,就是不会用,也看不明白博主写的用法

    [回复]

  3. 什么减肥药最有效 什么减肥药最有效 Says:

    好评

    [回复]

  4. 一路发发减肥网 一路发发减肥网 Says:

    很好啊,学习了

    [回复]

  5. 淘宝网女装 淘宝网女装 Says:

    一如即往的支持~~~

    [回复]

  6. 成都办证 成都办证 Says:

    支持柳城

    [回复]

  7. Zachary Lofquist Zachary Lofquist Says:

    It is corporeal pleasure to know you blog!

    [回复]

  8. 瑞士军刀背包 瑞士军刀背包 Says:

    呵呵,正在找这个东东,谢谢楼主的分享

    [回复]

  9. 瑞士军刀背包 瑞士军刀背包 Says:

    WP确实有很多地方需要研究啊

    [回复]

  10. Ugg Boot Sale UK Ugg Boot Sale UK Says:

    每次来都有收获啊

    [回复]

  11. cheap canadian goose parka cheap canadian goose parka Says:

    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

    [回复]

2 Trackbacks For This Post

  1. canada goose coats Says:

    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...

  2. UGG 5225 Says:

    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...

Leave a Reply

广告招租

[强] [握手] [可爱] [ok] [呲牙] :) [偷笑] [流泪] [疑问] [亲亲] [擦汗] [得意] [衰] [可怜] [抱拳] [坏笑] more »

无觅相关文章插件,快速提升流量