Typecho技巧之增加評論需要算術驗證的小功能

2021-10-10 04:33:18 字數 2188 閱讀 4396

這是不是讓人很煩?

操作很簡單,就是增加幾行**而已。

目前就博主使用的cuteen主題為具體例子

進入目錄~/themes/cuteen/function.php

if(!

defined

('__typecho_root_dir__'

)) exit;

require_once

("core/cuteen.php");

require_once

("core/content.php");

require_once

("core/shortcodeuse.php");

function

themeinit

($self

)function spam_protection_math()

function spam_protection_pre($comment, $post, $result)

return $comment;}*/

//該注釋部分即將要新增的**

error_reporting(0

);typecho_plugin:

:factory

('widget_abstract_contents')-

>

contentex

=array

('cuteen'

,'parsecontent');

typecho_plugin:

:factory

('widget_abstract_contents')-

>

excerptex

=array

('cuteen'

,'parsecontent');

typecho_plugin:

:factory

('admin/write-post.php')-

>

bottom

=array

('content'

,'editaddbutton');

typecho_plugin:

:factory

('admin/write-page.php')-

>

bottom

=array

('content'

,'editaddbutton'

);

看到上方**的注釋部分了嗎?

這就是我們即將新增的**,但是,這是針對cuteen主題的。

其它主題請使用下方**:

function

themeinit

($comment

)function

spam_protection_math()

function

spam_protection_pre

($comment

,$post

,$result

)return

$comment;}

上方是50以內的數相加,如果覺得很難的話~可以將其更改為你自己所需要的數值。

看一下實際的頁面效果:

新增以下**:

<?php 

spam_protection_math()

;?>

將其插入適當的位置,但什麼是適當的位置呢?我將自己的**給讀者參考一下。

進入主題——設定——高階設定——自定義css

填入以下**:

BlueLake主題增加gitment評論

你會得到乙個 client id 和乙個 client secret,這個將被用於之後的使用者登入。gitment enable true mint true count true lazy true cleanly true 是否隱藏 powered by language en 語言,置空則隨主...

Hexo主題yilia增加gitalk評論外掛程式

在layout partial post目錄下新增gitalk.ejs檔案 檔案內寫入如下 修改source src css 目錄下comment.scss檔案 padding 0 30px important min height 20px sohucs gitalk enable true gi...

Hexo主題yilia增加gitalk評論外掛程式

如下 如下 padding 0 30px important min height 20px sohucs 如下 如下 gitalk enable true 是否開啟 githubid liu1340308350 你的github使用者名稱 repo liu1340308350.github.io ...