• Resolved Blue Squirrel

    (@blue-squirrel)


    Hi,

    Is there anyway to force the Contact Form (when used in a Widget) to send the form with the subject being the name of the page it was sent from?

    I guess it would look something like

    [contact-field label='Subject' type='subject' default='$PAGE_NAME' required='1'/]

    but I can’t work out how to implement it despite having been trawling round for some time! Apologies if this one gets asked often.

    Many thanks to anyone who can offer any help 🙂

    http://wordpress.org/plugins/jetpack/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    I’m afraid that’s not possible. Since the form is in a widget, it is part of the WordPress loop and is not aware of the page title or content.

    Thread Starter Blue Squirrel

    (@blue-squirrel)

    Oh that’s a shame thanks for the reply Jeremy – and the education, I didn’t realise that was the case.

    Can I do it manually by adding code to each widgitised version of the contact form or will the plugins settings overrule the HTML I add?

    <INPUT TYPE="hidden" NAME="subject" VALUE="Your Subject">

    Thanks again and for all the work you put into the plugin and its support.

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    I can’t think of any work around, unfortunately. As long as the shortcode is in a widget, I can’t think of any way you’d be able to collect information about the page you’re on.

    Thread Starter Blue Squirrel

    (@blue-squirrel)

    Sorry Jeremy, I probably wasn’t very clear.

    I use Widget Logic to make widgets appear on certain pages so I can create say 5 different Jetpack contacts forms across 5 different pages. I guess what I’m trying to get at is if I hardcode the widgetised contact form that appears on “Page 1” as…

    <INPUT TYPE="hidden" NAME="subject" VALUE="This Came From Page 1">

    …will the contact form be sent with that subject or will Jetpack’s default/specified Subject take precedence/dominance over that?

    Plugin Author Jeremy Herve

    (@jeherve)

    Jetpack Mechanic 🚀

    Oh right. Widget Logic (or Jetpack’s Widget Visibility module) is a nice workaround.

    You can define custom subjects for each contact form thanks to the subject parameter, like so (note the subject='custom subject' parameter in the shortcode):

    [contact-form subject='custom subject'][contact-field label='Name' type='name' required='1'/][contact-field label='Email' type='email' required='1'/][contact-field label='Website' type='url'/][contact-field label='Comment' type='textarea' required='1'/][/contact-form]

    Thread Starter Blue Squirrel

    (@blue-squirrel)

    Ah thank you Jeremy, you are a living legend and a prince amongst men.

    I wasn’t aware of Jetpack’s Widget Visibility module, I can’t keep up with everything being added – I need to sit down and take the time to have a closer look.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Contact Form: Subject = Page Title’ is closed to new replies.