文章最后更新时间:
使用子比主题,我们通常会让用户评论来获取内容,这无疑帮助我们带来了大量的用户,但是很多用户评论内容会显得非常的2(用户除了扣6,就是乱发一些数字)
我们这时可以增加一个小功能(自动打卡),效果如下,可以自动调用评论的时间,让用户填入我们内置的文字。
修改的教程稍微有些复杂,修改的整体思路如下
后台自定义js代码的填入 wp-content/themes/zibll/template/comments.php文件,第124行增加文章源自墨非网-https://www.mf8.site/2341.html
[erphpdown]文章源自墨非网-https://www.mf8.site/2341.html
if (_pz('comment_signin')) { echo zib_get_input_expand_but('signin'); }
[/erphpdown]
wp-content/themes/zibll/inc/options/admin-options.php文件,第4824行增加文章源自墨非网-https://www.mf8.site/2341.html
[erphpdown]文章源自墨非网-https://www.mf8.site/2341.html
array( 'dependency' => array('close_comments', '==', '', '', 'visible'), 'id' => 'comment_signin', 'class' => 'compact', 'type' => 'switcher', 'default' => true, 'title' => __('允许用户快速打卡', 'zib_language'), ),
[/erphpdown]
wp-content/themes/zibll/inc/funtions/functions.php文件,第1624行增加文章源自墨非网-https://www.mf8.site/2341.html
[erphpdown]文章源自墨非网-https://www.mf8.site/2341.html
// 打卡 if ('signin' == $type) { $but = '<a class="but input-signin mr6" href="javascript:fancypig.simple.daka();"><i class="fa fa-check-square-o"></i><span class="hide-sm">打卡</span></a>'; }
[/erphpdown]
后台自定义javascript代码中,增加:文章源自墨非网-https://www.mf8.site/2341.html
[erphpdown]文章源自墨非网-https://www.mf8.site/2341.html
function a(a, b, c) { if (document.selection) a.focus(), sel = document.selection.createRange(), c ? sel.text = b + sel.text + c: sel.text = b, a.focus(); else if (a.selectionStart || "0" == a.selectionStart) { var l = a.selectionStart, m = a.selectionEnd, n = m; c ? a.value = a.value.substring(0, l) + b + a.value.substring(l, m) + c + a.value.substring(m, a.value.length) : a.value = a.value.substring(0, l) + b + a.value.substring(m, a.value.length); c ? n += b.length + c.length: n += b.length - m + l; l == m && c && (n -= c.length); a.focus(); a.selectionStart = n; a.selectionEnd = n } else a.value += b + c, a.focus() } var b = (new Date).toLocaleTimeString(), c = document.getElementById("comment") || 0; window.fancypig = {}; window.fancypig.simple = { daka: function() { a(c, "滴!粉丝卡!打卡时间:" + b, ",请上车的乘客系好安全带~") }, zan: function() { a(c, " 文章写得不错,给你点个赞,继续加油哈!") }, cai: function() { a(c, "骚年,我怀疑你写了一篇假的文章!") } };
[/erphpdown]文章源自墨非网-https://www.mf8.site/2341.html
文章源自墨非网-https://www.mf8.site/2341.html
使用方法 修改完成代码后,别忘了后台里关闭,然后再开启保存就行了! 文章&列表>评论设置>允许用户快速打卡文章源自墨非网-https://www.mf8.site/2341.html
本次修改的子比版本是:7.8版本,提示:修改之前请备份、备份、备份。文章源自墨非网-https://www.mf8.site/2341.html
暂无评论内容