加入收藏 | 设为首页 | 会员中心 | 我要投稿 均轻资讯网_我爱站长网 (https://www.52junqing.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 教程 > 正文

Wordpress更换后面编辑器为ueditor编辑器

发布时间:2022-06-24 10:49:37 所属栏目:教程 来源:互联网
导读:ueditor为国内少有的优秀编辑器了,它有自动图片下载,自动保存及格式化排版功能了,同时还有代码功能这些功能都非常的实用了,下面我们就来介绍替换Wordpress 后台编辑器为 百度ueditor 编辑器,希望文章对各位有帮助. 1、下载/安装 下载并安装wordpress,下载百
  ueditor为国内少有的优秀编辑器了,它有自动图片下载,自动保存及格式化排版功能了,同时还有代码功能这些功能都非常的实用了,下面我们就来介绍替换Wordpress 后台编辑器为 百度ueditor 编辑器,希望文章对各位有帮助.
 
  1、下载/安装
 
  下载并安装wordpress,下载百度编辑器wp插件.
 
  2、安装百度编辑器
 
  2.1解压之后,把ueditor文件夹复制到wp-content/plugins/下面.
 
  2.2.复制ueditor文件下的 general-template.php 文件到wp-includes/文件夹下面,复制原文件, 或者先把源文件改名.
 
  2.3.修改 general-template.php,大约在文件的第1790行左右:
 
  function wp_editor($content, $id = 'content')
 
  {
 
   echo '<textarea class="wp-editor-area" rows="20" tabindex="1" cols="40"
 
    name="content" id="content" style="display: none; " aria-hidden="true">'.$content.'</textarea>';
 
   echo '<script type="text/javascript" src="../wp-content/plugins/ueditor/editor_config.js"></script>';
 
   echo '<script type="text/javascript" src="../wp-content/plugins/ueditor/editor-all.js"></script>';
 
   echo '<link rel="stylesheet" type="text/css" href="../wp-content/plugins/ueditor/themes/default/ueditor.css"/>';
 
   echo "<script type='text/javascript'>
 
     var editor = new baidu.editor.ui.Editor(
 
     {  //phpfensi.com
 
      initialContent:document.getElementById('content').value,
 
      textarea:'content'
 
     });
 
     editor.render('content')
 
    </script>";
 
  }
 
  2.4.修改 wp-content/plugins/ueditor/editor_config.js,在开始的地方修改为:
 
  var URL=window.location.protocol+"//"+window.location.hostname+"/wp-content/plugins/ueditor/";
 
  //这里你可以配置成ueditor目录在您网站的相对路径
 
  3、修饰
 
  修改wp-admin/下面的wp-admin.css,查找#wp-word-count:
 
  #wp-word-count{display:none;padding:2px 10px;}<strong> </strong>/*这个是统计字数的,因为百度编辑器已经有了这个功能,所以none掉,不过可有可无!*/
 
  4、注意
 
  目前官方提供的版本只支持 V3.2.1 版本的Wordpress,对于新版的Wordpress 还存在很多BUG和不足,不建议用在3.2.1以上版本的Wordpress.因此百度编辑器仅供测试.
 

(编辑:均轻资讯网_我爱站长网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!