Quantcast
Channel: Topic Tag: contact-form | WordPress.org
Viewing all articles
Browse latest Browse all 5994

Howdy_McGee on "[Plugin: Contact Form 7] Dynamically Add C7 Form Recipient - CPTs Involved"

$
0
0

So let me explain my situation first. I have a Staff CPT and with it the user would put the Staff Name in the Title of the post and an Email address in a metabox. Then on the page I add 1 Contact Form 7 form where I needed to change the email depending on what Staff page the person was viewing. I ran into this link:

http://xaviesteve.com/3298/wordpress-contact-form-7-hook-unofficial-developer-documentation-and-examples/

Where I was able to make these function which will break down the URL, get post by slug, then get the meta and spit it back into the contact form. Of course this will not work for everybody, if you have categories you would need to modify the function.

If you want to test it, what I ended up doing is adding this to my wp_config file so my form doesn't go through AJAX

define ('WPCF7_LOAD_JS', false);

then I added this to my functions.php file:

http://pastebin.com/6h4HjdJ6

before the conditional_email() function end you would want to spit out the WPCF7 object and then die() so that the form doesn't submit. Hopefully somebody else out there finds this useful ^_^ !


Viewing all articles
Browse latest Browse all 5994

Trending Articles