简体   繁体   English

联系表格7按钮可通过高级自定义字段进行编辑

[英]Contact Form 7 Button Editable Via Advanced Custom Fields

I am using Contact Form 7 on a website I'm working on, it is being used as an inquiry form in the sidebar. 我正在工作的网站上使用联系表7,它在侧栏中用作查询表。 Now the client would like this form to have the button text (eg Request a Quote) editable per page, I do not want to make a different sidebar for every page because that wouldn't be user friendly and there's over 100+ pages. 现在,客户希望这种形式的按钮文本(例如,请求报价)每页都可编辑,我不想为每个页面制作不同的侧边栏,因为那不是用户友好的,并且页面超过100个。

I was wondering there must be a way to do this with Advanced Custom Fields as I have managed it with the widget title. 我想知道是否有一种方法可以对“高级自定义字段”执行此操作,因为我已使用小部件标题对其进行了管理。 Any help/advice will be appreciated as I just need to find where the submit button and text is echo'd. 任何帮助/建议将不胜感激,因为我只需要查找回显提交按钮和文本的位置。

Update: You can execute PHP inside the "Edit form" area but not between speech marks. 更新:您可以在“编辑表单”区域内执行PHP,但不能在语音标记之间执行PHP。 Hmm.

http://wordpress.org/extend/plugins/contact-form-7/ http://wordpress.org/extend/plugins/contact-form-7/

For anyone wanting to do this in future here is the solution: 对于将来想要这样做的人,这里是解决方案:

Go to the contact form 7 directory > modules > submit.php 转到联系表7目录>模块> Submit.php

Put your ACF field in a variable like so: 将您的ACF字段放入变量,如下所示:

$test =  get_field('form_button');

And then change 然后换

$atts['value'] = $value; 

to

$atts['value'] = $test;

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM