gpt4 book ai didi

jquery - 如何使用Jquery加载wp_editor?

转载 作者:行者123 更新时间:2023-12-03 22:27:40 25 4
gpt4 key购买 nike

我想在我的自定义插件中使用 jquery 动态添加 WordPress 编辑器,如下所示:

 <?php

$content = '';

$editor_id = 'mycustomeditor';

?>

$('#container').append('<?php wp_editor( $content, $editor_id );?>');

我收到错误:

SyntaxError: missing ) after argument list

...-active"><link rel='stylesheet' id='editor-buttons-css'  href='http://localhost 

我还尝试了以下代码(这里我已将单引号替换为双引号):

  <?php

$content = '';

$editor_id = 'mycustomeditor';

?>

$('#container').append("<?php wp_editor( $content, $editor_id );?>");

我收到错误:

 SyntaxError: missing ) after argument list   


$('#container').append("<div id="wp-mycustomeditor-wrap" class="wp-core-ui wp-ed...

如果您有任何解决方案,请告诉我。

提前致谢

最佳答案

我知道迟到的答案。但这会帮助其他人。试试这个 jQuery 插件。

https://github.com/anteprimorac/js-wp-editor

您可以使用如下简单的

    jQuery(document).ready(function (){

jQuery('#container').wp_editor();

});

关于jquery - 如何使用Jquery加载wp_editor?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25644967/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com