Ready to get started?Download WordPress


Contact Form 7
[resolved] Choosing a recipent based on a custom field (Contact Form 7) (3 posts)

  1. saadibrahim
    Posted 3 years ago #


    Ok so heres what i need this is my page:


    doctors is a custom post types

    now the only problem i am facing is that I want to email the contents of this form to the email associated with the doctor the user is viewing (the email is saved in a custom field)

    how is this possible?

    p.s i am using the following code on my single-doctor.php template:

    <?php echo do_shortcode( '[contact-form 2 "Contact Us Form"]' ); ?>



  2. kato
    Posted 3 years ago #

    Probably easiest to set up 6 different contact forms for each doctor.

    Repetitive, and somewhat inefficient. But much easier than custom coding.

    That way for each tab, you just substitute different shortcodes:

    <?php echo do_shortcode( '[contact-form 1 "Contact Smith"]' ); ?>
    <?php echo do_shortcode( '[contact-form 2 "Contact Kahn"]' ); ?>
    <?php echo do_shortcode( '[contact-form 3 "Contact Mel"]' ); ?>
    <?php echo do_shortcode( '[contact-form 4 "Contact Blood"]' ); ?>
    <?php echo do_shortcode( '[contact-form 5 "Contact Zeus"]' ); ?>
    <?php echo do_shortcode( '[contact-form 6 "Contact Dr. Waffen"]' ); ?>

  3. thetrickster
    Posted 3 years ago #

    Here's how it's done.

    1. Create a new dropdown tag called "email_recipients"
    2. For the values of the dropdown use a pipe to separate the NAME from the VALUE. IE- Store a name of the doctor and their email address. "Dr. Smith|drsmithsemail@mail.com" You can list multiple doctors on a separate line
    3. In your the section where you edit the form email content, change the "To:" field to your new field: [email_recipients]

    Now when someone chooses a Doctor it will go to the email address you passed in with the "pipe method".

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic