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

Posted on 08 六月 2009 by 柳城 ,阅读 335 简洁版

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详细用法 | 柳城

赞助商

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

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

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

    [回复]

Leave a Reply

广告招租

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

博百优 博百优 Advertise Here

最新评论

赞助商

广告招租
Lc.live