Tagged: CONTACT FORM, subject line
Hi!
I wonder what code i should add to get change the subject line on two contact forms which is located on the same page ?
Today i use this code when having one form.
add_filter('avf_form_subject','avia_change_mail_subject', 10, 3);
function avia_change_mail_subject($subject, $new_post, $form_params)
{
$subject = "Bokning från " . urldecode($new_post['1_1']);
return $subject;
}
Is it possible to ID a form and then change the subject line ?
Thanx!
Hey Paul,
Could you please give us a link to your website, we need more context to be able to help you.
Best regards,
Victoria
Hi!
Sure!
It’s one website for a restaurant that has two different menus and venues (though they are located just beside each other)
Hi paullindqvist,
No, that code will apply to all forms. Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
For more flexible contact forms experience, you could use a plugin, like Contact Form 7
https://contactform7.com/
Best regards,
Victoria
Hi paullindqvist,
You can try to id the form by the subject, not the optimal way, but could work.
Here is the code you can put in your funtions.php
add_filter('avf_form_subject','avia_change_mail_subject', 10, 3);
function avia_change_mail_subject($subject, $new_post, $form_params)
{
if ($subject == "Bokning Indian Resturant" || subject == "Bokning Indian Bistro") {
$subject = "Bokning från " . urldecode($form_params);
}
return $subject;
}
If you need further assistance please let us know.
Best regards,
Victoria