我想在提交电子邮件时设置报价单号。这是我要设置的形式的变量。]>
[隐藏的frnum id:frnum]
在functions.php中
function wpcf7_setup_quotenum($WPCF7_ContactForm) { if ($WPCF7_ContactForm->id() == '3550') { //Get current form $wpcf7 = WPCF7_ContactForm::get_current(); // get current SUBMISSION instance $submission = WPCF7_Submission::get_instance(); // Ok go forward if ($submission) { $_POST['frnum'] = 'test'; } } }
这是获取电话号码的电子邮件代码。
[您的名字]认为您会对这辆叉车租赁报价#:FR [frnum]]感兴趣
我最终将拥有将代码设置为唯一数字的代码,只是试图让某些内容显示在电子邮件中。
感谢您为我指出正确的方向。
我想在提交电子邮件时设置报价单号。这是我要设置的形式的变量。函数.php中的[hidden frnum id:frnum]函数wpcf7_setup_quotenum($ ...
对于将来的任何人,这就是我最终得到的:
if ($WPCF7_ContactForm->id() == '3550') {
//Get current form
$wpcf7 = WPCF7_ContactForm::get_current();
// get current SUBMISSION instance
$submission = WPCF7_Submission::get_instance();
// Ok go forward
if ($submission) {
// do some replacements in the cf7 email body
$mail = $wpcf7->prop('mail');
// Find/replace the "[frnum]" tag as defined in your CF7 email body
// and add changes name
$mail['body'] = str_replace('[frnum]', 'test', $mail['body']);
//$mail['body'] = '[frnum]' => 'test';
// Save the email body
$wpcf7->set_properties(array(
"mail" => $mail
));
// return current cf7 instance
return $wpcf7;
}
}