高级自定义字段(ACF)中继器+联系表7 [英] advanced custom field (ACF) Repeater + Contact Form 7

查看:69
本文介绍了高级自定义字段(ACF)中继器+联系表7的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Repeater字段,可创建"工作"每个工作都有标题,文本作为子字段以及发送工作申请的联系表7.

I have a Repeater field which creates "jobs" each job has title, text as sub-fields and also a contact form 7 form which sends jobs applications.

我要添加隐藏字段,该字段还将发送子字段"标题"因此,无论何时提交表格,我们都知道发件人从哪个职位发送了申请表

I want to add hidden field which will also send the sub-field "title" so whenever form is submitted we know which job the sender sent the application from

尝试使用:
联系表格7动态文本扩展

但是据我所知,它不能与ACF一起使用任何帮助将不胜感激

but it is not working with ACF as far as I'm concern any help will be appreciated

推荐答案

您可以在显示表单之前使用CF7的"wpcf7_form_hidden_​​fields"过滤器,

you could use CF7's 'wpcf7_form_hidden_fields' filter before your form is displayed,

add_filter('wpcf7_form_hidden_fields', 'add_job_title');
function add_job_title($hidden){
 //$current_job is the currenlty job loaded.
 $hidden['job_title']= $current_job->sub_title;
 return $hidden;
}

提交表单时, $ _ POST ['job_title'] 将具有隐藏字段的值.

when the form is submitted, $_POST['job_title'] will have the value of the hidden field.

这篇关于高级自定义字段(ACF)中继器+联系表7的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆