欢迎光临
我们一直在努力

wordpress 安装点击数插件设置

1、安装WP-PostViews插件,启用,设置PostViews,
其他不动:
Views Template:浏览数:%VIEW_COUNT%

2、调用浏览数:
外观,编辑,文章页面 (single.php),在合适位置加入如下代码:

[code]<?php if(function_exists(&#39;the_views&#39;)) { the_views(); } ?>&amp;nbsp;&amp;nbsp;[/code]
3、调用排行榜:
在主题文件sidebar.php文件中的相应位位置添加代码

显示阅读次数最多的文章或页面:
[code]<?php if (function_exists(&#39;get_most_viewed&#39;)): ?>
<?php get_most_viewed(); ?>
<?php endif; ?> [/code]

只显示阅读次数最多的文章:
[code]<?php if (function_exists(&#39;get_most_viewed&#39;)): ?>
<?php get_most_viewed(&#39;post&#39;); ?>
<?php endif; ?> [/code]

只想显示10篇阅读次数最多的文章:
[code]<?php if (function_exists(&#39;get_most_viewed&#39;)): ?>
<?php get_most_viewed(&#39;post&#39;,10); ?>
<?php endif; ?> [/code]

在get_most_viewed 函数中的参数10决定要显示的篇数

显示显示某类别下的阅读次数最多的文章:
[code]<?php if (function_exists(&#39;get_most_viewed_category&#39;)): ?>
<?php get_most_viewed_category(the_catagory_ID(false)); ?>
<?php endif; ?> [/code]

在get_most_viewed_category函数类别ID决定显示的分类

 

赞(0) 打赏
未经允许不得转载:刘旭的人个博客 » wordpress 安装点击数插件设置
分享到: 更多 (0)
标签:

评论 抢沙发

评论前必须登录!

 

QQ :13945502电话:13913571631

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏

×
订阅图标按钮