zoukankan      html  css  js  c++  java
  • wordpress文章点击次数统计插件WP Postviews 使用方法

    wordpress文章点击次数统计插件WP Postviews

    介绍一款比较常用的wordpress插件:WP Postviews,WP Postviews插件是一款为wordpress量身打造的文章点击次数统计插件,WP Postviews还可以实
    现热门文章等功能,此款插件非常强大而且易用。


    方法/步骤
    1
    WP-Postviews 安装非常简单,只要下载和激活该插件即可。然后到 WP 后台 > 设置 > Postviews 配置输出

    2
    首先它可以让你设置统计那些用户的浏览,everyone 是统计所有人,guest 是普通用户,registered user only 只统计注册用户 。

    Postviews 可以让你选择是否统计蜘蛛爬虫的浏览。

    3
    设置显示的模板

    它还可以让你显示浏览次数最多的日志列表的模板

    另外它还能详细设置哪些页面可以显示日志的浏览此数和显示给谁,我觉得这个貌似有点多余了。

    当你卸载 Postviews 的时候,它还可以让你把写入到 options 的选项删除了。

    用法
    Open wp-content/themes/<YOUR THEME NAME>/index.php
    You may place it in archive.php, single.php, post.php or page.php also.
    Find: <?php while (have_posts()) : the_post(); ?>
    Add Anywhere Below It (The Place You Want The Views To Show): <?php if(function_exists('the_views')) { the_views(); } ?>
    Or you can use the shortcode [views] or [views id="1"] (where 1 is the post ID) in a post
    Go to WP-Admin -> Settings -> PostViews to configure the plugin.

    4
    要让你的博客在页面上显示浏览次数,你需要修改你博客当前使用的主题,在single.php文件中插入以下代码:

    <?php if(function_exists('the_views')) { the_views(); } ?>

    5
    保存就OK了!

    注意事项
    注意代码插入位置,否则会出现乱码

    比如文件末尾即可测试用户点击效果 (我爱分享资源

  • 相关阅读:
    docker 容器使用 systemctl 命令报错
    lxml 这个包和openpyxl 起冲突
    解决GPG error: The following signatures couldn't be verified because the public key is not available
    pyinstaller bug
    PyCharm使用技巧及常用快捷键
    python 软件目录规范
    Wpf canvas 绘图 像素对齐
    wpf ListView 隔行 (各行) 显示 不同 背景 颜色
    C# wpf 获取 数字 类型 所占字节数
    Mybatis-Plus QueryWrapper +sql自定义查询
  • 原文地址:https://www.cnblogs.com/it-tsz/p/13548544.html
Copyright © 2011-2022 走看看