这东西可以通过修改 theme 的 comment.php (路径: Appearance->Editor->Comments(或者其他类似的))来达到目标。

基本原理是这篇文字的内容。

问题是,现在 WP 的评论框非常之省事:

[php] <?php comment_form();?> [/php]

这就是评论了。

怎么修改?

自己去魔改 args 即可。

参考 How to Quickly and Easily Customize the WordPress Comments Form,可以知道,可以通过修改参数完成自定义。用法是送一个数组进 comment_form 方法。

修改后Comment如下:

[php] <?php comments_args = array( 'title_reply'=&gt;'Tell us about you!', 'comment_notes_before'=&gt;'', 'comment_notes_after'=&gt;'', 'comment_field'=&gt;'&lt;p class=&quot;comment-form-comment&quot;&gt;&lt;label for=&quot;comment&quot;&gt;' . _x( 'Comment', 'noun' ) . '&lt;/label&gt;&lt;textarea name=&quot;comment&quot; id=&quot;comment&quot; cols=&quot;105&quot; rows=&quot;10&quot; tabindex=&quot;4&quot; onkeydown=&quot;if(event.ctrlKey&amp;&amp;event.keyCode==13){document.getElementById(\'submit\').click();return false};&quot;&gt; &lt;/textarea&gt;&lt;/p&gt;', ); comment_form(comments_args); ?> [/php]

Update:

现在我们在 macOS 下面, 希望 command + enter 也能实现统一的功能

这其实也很简单. 可以参考这个讨论和这个实现

已知 metaKey 就是我们想要的 command, 最粗暴的方法是 ctrlKey/metaKey 取 or, 然后加上 enter 即可:

[php] ... onkeydown="if((event.ctrlKey || event.metaKey)&&event.keyCode==13){document.getElementById('submit').click();return false};"> ... [/php]

PS: 原作者木木木木木有新博文: WordPress 后台评论 Ctrl+Enter 快捷回复说是jquery实现。 可惜没时间测试了。待有空吧。