【问题标题】:how to load ckeditor in wordpress如何在wordpress中加载ckeditor
【发布时间】:2011-01-18 04:56:38
【问题描述】:

我有一个 wordpress 网站,我在管理区域仪表板中创建了一个包含文本区域的框,现在我希望我的 textarea 实现 ckeditor,有人知道该怎么做吗?

这是我在主题functions.php中的代码sn-p

    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
    }

如果你在上面看到,我的代码 sn-p 上面有一个文本区域,我想将该文本区域更改为 ckeditor UI。

提前致谢 和

【问题讨论】:

    标签: php javascript wordpress ckeditor


    【解决方案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>
    

    【讨论】:

    • 嗨,是的,我安装了ckeditor插件,我尝试了你的解决方法,但它仍然不起作用,因为在仪表板管理区域,没有加载ckeditor的js文件,所以当你说:CKEDITOR.replace 它会返回错误,因为没有这样的方法叫做 CKEDITOR.replace。谢谢你的回复
    猜你喜欢
    • 1970-01-01
    • 2013-07-16
    • 2014-03-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-18
    • 2012-02-26
    • 1970-01-01
    相关资源
    最近更新 更多