Support » Plugin: Contact Form 7 Dynamic Text Extension » How to use shortcodes in hidden dynamic fields?

  • Resolved sp880111


    Imagine I am able to retrieve an e-Mail address on the page the form is included via
    <?php echo do_shortcode('[CF7_get_email_from_post_id post_id="'.$id.'"]'); ?>

    Now, how can I use this email address as the recipient email address in the form?

    I tried to use a dynamic hidden field:

    [dynamichidden recipient-email "CF7_get_email_from_post_id post_id=$id"]
    [recipient-email] then goes into the To field of the Contact Form.

    My main problem here is the post_id parameter of the short code. I can’t figure out how to set it up correctly.

    Thank you

Viewing 1 replies (of 1 total)
  • Plugin Author sevenspark


    You can’t pass a PHP variable in a shortcode. The shortcode handler function would need to be responsible for determining the ID if it is dynamic (most likely $post->ID, just use global $post if referring to the current page), or you could pass a static value instead.

Viewing 1 replies (of 1 total)
  • The topic ‘How to use shortcodes in hidden dynamic fields?’ is closed to new replies.