↓ 快轉到主要內容

添加纪念日小工具

·598 字·2 分鐘
Y Cheung
作者
Y Cheung
Blogger, Programer & Traveler.

由https://coels.net/开发的纪念日小工具 。可自由DIY,添加方式也很简单,放入后台widget就行了。 记住:JavaScript中双引号是不能换行的!!!!! 就是因为这个,我折腾了一下午才正确放置好这个小工具!都怪我手贱得勾选了自动分段!!!郁闷啊~~~~ 本来想添加ctrl+enter回复功能的,可是折腾了一下午都失败了。 不知道是不是主题不支持….. 参考:https://blog.dogg3h.com/wordpress-hack-ctrl-enter-post-comment(该链接已失效) 已经解决这个问题了。参考:https://www.bhqt.cn/wordpress-no-forget/(该链接已失效) 修改评论回复为Ctrl+Enter提交回复。 在模板的comments.php中查找:

1<?php if ( $user_ID ) : ?>

如果你的form标签中没有如下属性请自行加上。

1name="commentform"

再往下拉一点,你可以看到类似的两行:

如果textarea标签上没有id属性,请按照上面的内容加上。 如果在第二行中发现如下代码,则删除之。

1name="submit"

如果你发现还是不行,把 id=“submit” 改为 id=“submitit” ,这样肯定是可以了。 最后查找

在其后边增加

1var commenttextarea = document.getElementById('comment'); commenttextarea.onkeydown = function quickSubmit(e) { if (!e) var e = window.event; //alert(e.keyCode); if (e.ctrlKey && e.keyCode == 13){ //alert('good'); document.getElementById('commentform').submit(); } };

参考:https://bingu.net/512/wordpress-hack-use-ctrl-enter-submit-comment/

相關文章

Blog添加Sociable插件

·106 字·1 分鐘
这个不多说,很方便的一个插件,支持世界上主流的社会化分享网站,支持自定义图标,更多选项安装后在设置中调整。 Automatically add links on your posts, pages and RSS feed to your favorite social bookmarking sites. sociable plugin 缺点:默认图标很丑…..