【发布时间】:2014-09-18 15:11:13
【问题描述】:
我正在尝试在 INLINE 类型的 Magnific Popup 中使用 Advanced Custom Fields acf_form() function 在 WordPress 网站上编辑和创建帖子。这是一项正在进行的工作; here's the link。您可以使用用户名test和密码ukQfQ7zx7akPXH登录。
WordPress 内容编辑器可以工作,只是我无法在“视觉”选项卡内单击,这有点违背所见即所得的目的。
我已确保每个 ACF 表单都具有唯一的 id 属性。所以,我猜这个问题是与 TinyMCE 和 Magnific Popup 的某种冲突。但是,Chrome 中没有出现控制台错误。
有没有人遇到过这样的事情?
更新
这是新代码:
function cb_new_post_popup() { ?>
<div id="new-post-popup"
class="update-popup mfp-hide">
<h3>New Post</h3>
<?php
$current_user = wp_get_current_user();
$args = array('fields' => array('field_54134c496ff9d', 'field_541877c6025b3'),
'form_attributes' => array('id' => 'acf-form-new_post'),
'post_title' => true,
'post_content' => true,
'post_id' => 'new_post',
'new_post' => array('post_status' => 'publish'),
'return' => '%post_url%');
acf_form($args);
?>
<script>
jQuery(function($) {
acf.do_action('append', $('#new-post-popup'));
});
</script>
</div>
<?php }
第二次更新
我也尝试将其添加到 JS 中的 magnificPopup 函数中:
callbacks: {
open: function() {
console.log('Popup is opened');
acf.do_action('append', $(this));
},
close: function() {
tinymce.activeEditor.save();
}
// e.t.c.
}
【问题讨论】:
标签: javascript jquery wordpress tinymce magnific-popup