Wordpress 如何在弹出窗口中使用ACF字段

Wordpress 如何在弹出窗口中使用ACF字段,wordpress,advanced-custom-fields,Wordpress,Advanced Custom Fields,此函数显示我的弹出窗口 $('.call-hunt-btn').on('click', callHunt); function callHunt(e) { e.preventDefault(); $.arcticmodal({ type: 'ajax', url: 'wp-content/themes/beton/modals/modal-feedback.php', overlay: { css:

此函数显示我的弹出窗口

 $('.call-hunt-btn').on('click', callHunt);

 function callHunt(e) {
    e.preventDefault();

    $.arcticmodal({
        type: 'ajax',
        url: 'wp-content/themes/beton/modals/modal-feedback.php',
        overlay: {
            css: {
                backgroundColor: '#000',
                opacity: .75
            }
        },
        afterOpen: function(){
            setMaskPhone();
            setDataSBJS('.arcticmodal-container');
        }
    });
}
它使用一个php模板。我想在此模板中使用ACF字段
如果我只是写:
,但什么也没发生。
如何修复它?

如果要通过wp\u enqueue\u script()函数添加javascript,可以通过wp\u localize\u script()函数()公开ACF值


wp_localize_script()函数根据提供给wp_localize_script()的PHP数组中设置的值创建Javascript对象。然后可以使用点符号从Javascript对象访问ACF值。

如果您通过wp_enqueue_script()函数添加Javascript,则可以通过wp_localize_script()函数()公开ACF值


wp_localize_script()函数根据提供给wp_localize_script()的PHP数组中设置的值创建Javascript对象。然后可以使用点符号从Javascript对象访问ACF值。

您在哪里编写JS代码?在一个单独的文件中。并将此文件包含在页面底部。您在哪里编写JS代码?在一个单独的文件中。并将此文件包含在页面底部