LoginSignup
0
0

More than 5 years have passed since last update.

CKeditorで1on1メッセージング機能(チャット)を作って画像をアップロードする

Last updated at Posted at 2018-03-17

CKEditorのインストール

footer.phpの

footer.php
<?php wp_footer(); ?>
</body>
</html>

の前に以下を入れる。cdn便利!

footer.php
  <script src="https://cdn.ckeditor.com/4.9.0/standard/ckeditor.js"></script>
  <script src="<?php echo get_template_directory_uri(); ?>
/js/ckeditor_setting.js"></script>

CKEditorの設定

テーマフォルダにjsフォルダがあったのでそこに
ckeditor_setting.js
を作った。

ckeditor_setting.js
CKEDITOR.replace('editor1',{
  // uiColor: '#fff',
  height: 400,
  scayt_autoStartup: false,
  toolbarLocation: 'bottom',
  forcePasteAsPlainText: true,
  fillEmptyBlocks: false,
  tabSpaces: 0,
  // toolbar: [
  //   ['Image'],
  //   ],
});

中身はこんな感じ。

ckfinderのインストール

https://ckeditor.com/ckeditor-4/ckfinder/
ここからckfinderをダウンロードし、
先ほどのjsフォルダにインストール(コピペ)。

現状の安定版はv4.9.0のようです。

config.phpを編集する。

v4.9.0の場合は、
config.php
29行目
return false;true
69行目
'baseUrl' => '/ckfinder/userfiles/';
を、WordPressに入れるので
'baseUrl' => bloginfo($url).'/wp-content/uploads/chatmb/',
とする。

↑ ってので動くと思ったら動かない!!(´;ω;`)

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0