我一直在使用一个旧的Wordpress联系人表单插件(FastSecureContactForm)和一些几年前为我构建的javescript,用从ACF字段中拉出的文件标题下拉列表来动态填充表单中的一个字段。这对我来说工作得很好,但我已经重建了我的网站,现在正在使用Contact Form 7&希望重复这个功能。 之前使用的Javascript引用了ACF字段,并在FastSecureContactForm中引用了表单字段,其中文件名列表将动态构建为si_contact_ex_field2_3,其中数字2引用了设置中的表单2,数字3引用了表单上的额外字段3 (ex_field3)。j
这是我的代码的一个例子:
function acf_populate_age_select( $field ) {
//Get the values from textarea on option page
$site_settings = get_field('theme_settings','option');
$exhibitor_options = $site_settings[0]['exhibitor_options'];
//Turn the values in to an array
$a
所以我遇到了一些麻烦,我不确定如何才能做到这一点,但我想提供一个列表数组的高级自定义字段‘选择’字段,我不确定如何做正确。
下面是我的小部件类中的form方法:
// This is the backend of the widgets
public function form($instance)
{
$api = MailChimp_API::init();
var_dump($api->get_lists());
// Grab the widget ID
$widget_id = $this->id;
// The ACF Lis
我想在我的Wordpress帖子中添加一个“帖子作者”选择选项。我不想在Wordpress中创建大约30个不同的用户,而是想用一个自定义帖子类型(人员)的所有标题填充一个ACF下拉选择字段。
我发现这个代码用于输出自定义帖子类型标题的列表...
// query for your post type
$post_type_query = new WP_Query(
array (
'post_type' => 'your-post-type',
'posts_per_page' => -1