如何在wordpress中加载ckeditor

时间:2011-01-18 04:56:39

标签: php javascript wordpress ckeditor

我有一个wordpress网站,我在管理区仪表板上创建了一个包含文本区域的框,现在我想要我的textarea实现ckeditor,有谁知道怎么做?

这是主题functions.php

的代码片段
    function tresquint_news_dashboard_widget(){
     if ( $_POST['tresquint_submit_news'] ){
      $options = $_POST['tresquint_news'];
      $options['time'] = time();
      update_option('tresquint_news', $options );
      echo '<div class="updated fade"><p>Updated news.</p></div>';
     }
     $options = get_option("tresquint_news");
     ?><form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<p><?php _e("Enter a short news"); ?></p>
<p><label for="tresquint_news_text"><?php _e('News'); ?></label><textarea id="tresquint_news_text" style="width: 100%; margin-top: 5px;" name="tresquint_news[text]"><?php echo $options['text']; ?></textarea></p>
<p class="submit"><input style="float: right;" type="submit" name="tresquint_submit_news" value="<?php _e('Publish'); ?>" /><div class='clear'></div></p></form><?php
    }

如果您看到,我的代码片段上面有一个文本区域,我想将该文本区域更改为ckeditor UI。

提前致谢 和

1 个答案:

答案 0 :(得分:1)

您可以使用Plugin CKEditor For WordPress

我知道wordpress只有一点点,但你也可以使用ckeditor help

<textarea id="editor1" name="editor1"><p>Initial value.</p></textarea>
<script type="text/javascript">
    CKEDITOR.replace( 'editor1' );
</script>