• Resolved napsinbklyn

    (@napsinbklyn)


    Hi there!
    This may be a simple solution but I’m having a hard time figuring out how to insert a field that is generated dynamically by another plugin into the contact form.
    It’s a custom field that I am calling with the page template using the following:
    <?php echo get_post_meta( $post->ID, 'tenant_email_address', true ); ?>
    How would I put that into the contact form that is on the same page so that my contact form sends an email using data that is stored in the post meta?
    Thanks so much!

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter napsinbklyn

    (@napsinbklyn)

    In case this helps someone else, I was able to get this to work by creating a shortcode function:
    ‘<?
    add_shortcode( ‘meta_key’, ‘myshortcode’ );
    function myshortcode() {
    global $post;
    return ” . get_post_meta( $post->ID, ‘meta_key’, true );
    }
    ?>’
    then I used the following in my contact form:
    [dynamichidden alt-email “meta_key”] and [alt-email] in the mail tab.

    ??

    Maybe you can assist me?

    I want to get the following from form (without the site visitor knowing s/he is sending those info – as long as s/he sends the basic form)

    1. To get Post/Page Title
    2. To get post/page URL
    3. Two other custom fields (I will get the custom field names/tags from theme builder)

    My question now is:
    1. What Tags do I input into the Form Area?
    2. What Tags do I input into the Mail Area?

    Like I said, I would prefer it to be hidden from sender.

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get post meta for page with form’ is closed to new replies.