小技巧:在wordpress仪表盘中双击评论内容可编辑评论

  • 时间:2020-05-22 15:47:15
  • 分类:网络文摘
  • 阅读:81 次

在wordpress的仪表盘中,如果想要编辑某个评论,通常需要点击评论下方的编辑按钮方可实现。但很多人可能不知道,双击评论内容就可以对该评论进行编辑了。这个wordpress技巧虽然用处不大,但它从侧面告诉了我们wordpress的博大,既便是天天使用,也还有许多我们不了解的地方。

小技巧:在wordpress仪表盘中双击评论内容可编辑评论

当然,如果你不喜欢这个功能,只要添加下面的代码到wordpress主题的functions.php文件中,就可以去掉此功能。

  1. <?php
  2. /*
  3.  * Plugin Name: Remove Double-Click to Edit for Comments
  4.  * Description: Disables the double-click to edit action for comments
  5.  * Author: Pippin Williamson
  6.  * Version: 1.0
  7.  */
  8. class Remove_Double_Click_To_Edit {
  9.    public function __construct() {
  10.       add_action( 'admin_footer', array( $this, 'javascript' ) );
  11.    }
  12.    public function javascript() {
  13.       global $pagenow;
  14.       if( 'edit-comments.php' != $pagenow ) {
  15.          return;
  16.       }
  17. ?>
  18.       <script>
  19.       (function($){
  20.          $('tr.comment').each(function() {
  21.             $(this).find('a.vim-q').each(function() {
  22.                $(this).removeClass('vim-q');
  23.             });
  24.          });
  25.       }(jQuery));
  26.       </script>
  27. <?php
  28.    }
  29. }
  30. new Remove_Double_Click_To_Edit;

原文:http://www.ludou.org/wordpress-double-click-can-edit-comment.html

推荐阅读:
Content Ideas for New Blogs During the Pandemic  ‘Labeled For Reuse’ Gone: The Latest Disarming Change on Google   Blogging Magnates and Their Incredible Wealth  Join this Niche: Inspirational Charitable and Non-Profit Blogs  7 Passive Income Ideas to Complement Your Blog  Funny YouTuber Creates Device to Shoot Facemasks To Your Face  YouTube’s New “Viewer Applause” Feature Provides Revenue for Blo  Taiwanese Instagram Grandparents Prove Blogging and Social Media  These Incredible Hologram Machines Could Change the Vlogging Gam  Prepare All Keyboard Warriors: A TikTok and Twitter Merger is Ab 
评论列表
添加评论