Home – Download › Forums › Contact Forms › Get Page or User Details – Contact Form 7
Tagged: contact form 7
- This topic has 0 replies, 1 voice, and was last updated 6 years, 5 months ago by admin.
-
AuthorPosts
-
-
June 22, 2018 at 7:52 pm #64adminKeymaster
Get Page or User Details – Contact Form 7:-
We can dynamically insert page URL, page title, post-id, WooCommerce product id, ACF custom field, post meta value, etc to contact form 7 form.
Install Contact Form 7 Dynamic Text Extension. Now we can add dynamictext or dynamichidden input field.
Contact Form 7 Get Page URL
123[dynamichidden page-url "CF7_URL"][dynamichidden site-url "CF7_bloginfo show='url'"][dynamichidden post-id "CF7_get_post_var key='ID'"]More contact form 7 plugins. Get it nowContact Form 7 Get Page Title
Install Contact Form 7 Dynamic Text Extension. Then add the following shortcode to the form.
1[dynamichidden page-title CF7_get_post_var key='title']CF7 Get Post Meta or ACF Custom Field Value ( CF7_get_custom_field )
Add CF7_get_custom_field inbuild shortcode in contact form 7 form.
Example to get post locale custom field. It will take the current post If post_id is not added.
key: ACF or custom field key
1[dynamictext locale "CF7_get_custom_field post_id='5' key='_locale'"]Or
For ACF Custom Field Value
1[dynamictext* my-location "acf field='my_location' post_id='5' "]How to add contact form 7 on the WooCommerce product page?
Add the following code in your them functions.php
123456789add_action( 'woocommerce_after_add_to_cart_button', 'dcwd_add_cf7_form_under_add_to_cart' );function dcwd_add_cf7_form_under_add_to_cart() {// Add the hidden contact form. It will be displayed when the button is clicked.echo '<div id="askinfo" style="display:none">' . do_shortcode( '[contact-form-7 id="73" title="Contact form 1"]' ) . '</div>';// Button to open the popup.echo '<button><a href="#TB_inline?height=600&width=400&inlineId=askinfo" class="thickbox">Ask for Info</a></button>';// Add the thickbox JS and CSS for the popup.add_thickbox();}Retrieve SKU:-
12<p>SKU<br />[dynamictext product-sku "CF7_get_custom_field key='_sku'"]</p>In the email :
SKU: [product-sku]
How to save dynamic cf7 text data to the database?
Install CFDB7 or CF7ADB plugin.
You can connect an external MySQL database and process MySQL data using CF7ADB.
Dynamically Generate Values Within Shortcode
Add the following code to your theme functions.php
123456add_shortcode('wplog_random_text', 'wplog_custom_random_text');function wplog_custom_random_text( $atts ){$rand = rand(0, 9999999);return $rand;}Then we can add this data to
dynamictext.
Example:
[dynamictext random-number "wplog_random_text"]
-
-
AuthorPosts
- You must be logged in to reply to this topic.