• vanyatwo

    (@vanyatwo)


    Hi there.
    I’m setup WordPress Multisite.
    Is it possible to initialize Contact Form 7 in php template?
    I need this to use one single form for all sites in wp-network.
    But for each site form initialization I need to use different e-mail.
    I already have recepient e-mail in custom field (available on any page of site) for each site. How to connect this php variable to contact form?

    https://www.ads-software.com/plugins/contact-form-7/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Thread Starter vanyatwo

    (@vanyatwo)

    I didn’t understand how to use that, so find another solution:
    1) make field in wpcf;
    2) put into this field my variable by js.
    Works great, but for now I found another problem:
    I initialize contactform in this code

    <?php
    $original_blog_id = get_current_blog_id();
    switch_to_blog('1');
    
    echo do_shortcode('[contact-form-7 id="'.get_field('contact-right-wpcf','option').'"]');
    
    switch_to_blog($original_blog_id);
    ?>

    Contact form created in blog #1.
    When I go to contact-page in blog #1 – its ok, contactform works perfect, but if blog other than #1 – contactform displays, but doesn’t send anything. Always rotating near button. As I understand – it somehow understand difference in domain… Can we solve this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Initialize Form from php’ is closed to new replies.