现在一般的 WordPress 博客都有 AJAX 评论,支持 Ctrl+Enter 快捷键提交评论,这似乎成了一种习惯,博主在后台回复评论,也添加快捷键提交。

添加快捷键(ctrl+enter)提交评论,只需将下边的代码加到主题的最后一个 functions.php 的最后一个 ?> 前边即可实现快捷键提交评论:
/**
* WordPress 后台<a href="https://www.wpdaxue.com/tag/%e5%9b%9e%e5%a4%8d%e8%af%84%e8%ae%ba" title="查看与【回复评论】相关的文章" target="_blank" rel="noopener">回复评论</a>添加提交快捷键[Ctrl+Enter]
* https://www.wpdaxue.com/admin-comment-ctrl-enter-reply.html
*/
function Bing_admin_comment_ctrlenter(){
echo '<script type="text/javascript">
jQuery(document).ready(function($){
$("textarea").keypress(function(e){
if(e.ctrlKey&&e.which==13||e.which==10){
$("#replybtn").click();
}
});
});
</script>';
};
add_action('admin_footer', 'Bing_admin_comment_ctrlenter'); |
/**
* WordPress 后台<a href="https://www.wpdaxue.com/tag/%e5%9b%9e%e5%a4%8d%e8%af%84%e8%ae%ba" title="查看与【回复评论】相关的文章" target="_blank" rel="noopener">回复评论</a>添加提交快捷键[Ctrl+Enter]
* https://www.wpdaxue.com/admin-comment-ctrl-enter-reply.html
*/
function Bing_admin_comment_ctrlenter(){
echo '<script type="text/javascript">
jQuery(document).ready(function($){
$("textarea").keypress(function(e){
if(e.ctrlKey&&e.which==13||e.which==10){
$("#replybtn").click();
}
});
});
</script>';
};
add_action('admin_footer', 'Bing_admin_comment_ctrlenter');
来源:
https://www.wpdaxue.com/admin-comment-ctrl-enter-reply.html
微信公众号
手机浏览(小程序)
Warning: get_headers(): SSL operation failed with code 1. OpenSSL Error messages:
error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(): Failed to enable crypto in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57
Warning: get_headers(https://static.shanhubei.com/qrcode/qrcode_viewid_32433.jpg): failed to open stream: operation failed in
/mydata/web/wwwshanhubei/web/wp-content/themes/shanhuke/single.php on line
57