Wordpress替換後面編輯器為ueditor編輯器

來源:互聯網
上載者:User


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(
   {
    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.因此百度編輯器僅供測試

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.