code.png

目前的个人网站备案要求,个人博客网站不能开放评论功能。

  • Typecho后台没有关闭评论功能的设置选项,因此无法直接在Typecho里设置来实现关闭评论功能

修改代码,删去评论功能。

comments.php文件是主题的评论模块,是在网站根目录/usr/themes/你的主题/下,由post.php文件加载的。

post.png

  • 找到下面这一行:

    <?php $this->need('comments.php'); ?>
  • 添加注释

    <?php /*** 关闭评论 ***   $this->need('comments.php');  ****/ ?>
  • 评论计数器,也可以注释掉

    <span class="item">评论(<?php $this->commentsNum('0', '1', '%d'); ?>)</span>
    #  修改后
    <!----关闭评论计数---   <span class="item">评论(<?php $this->commentsNum('0', '1', '%d'); ?>)</span>   -->

    编辑文件 index.php 注释不显示评论数

     <!---不显示评论数---                 <a class="pc" href="<?php $this->permalink() ?>#comments"><i class="fa fa-comments-o"></i>评论(<?php $this->commentsNum('0', '1', '%d'); ?>)</a>  --->
分类: 学习编程

0 条评论

发表回复

Avatar placeholder

您的电子邮箱地址不会被公开。 必填项已用 * 标注