我想在我的自定义插件中使用 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/