Ok. Got it…
I write what I’ve done in case it could be useful for someone.
1) as first thing I’ve installed the plugin “Contact Form 7 – Dynamic Text Extension” which allows to send dynamic content trought CF7.
2) Then I’ve added the following code into “functions.php” which creates a Shortcut that I’ll put into the module itself:
function cf7_add_image_url(){
$feat_image = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );
return $feat_image;
}
add_shortcode('CF7_ADD_IMAGE_URL', 'cf7_add_image_url');
3) Finally, to get the url I’ve added this in my CF7.
This part in MODULE tab:
[dynamichidden featured-img “CF7_ADD_IMAGE_URL”]
and this field into MAIL tab
[featured-img]
NOTE. All the products’ pages have the same module.
To do this I’ve added this code into a part of Woo Commerce’s Single Product template (in this case it was here: /wp-content/plugins/woocommerce/templates/single-product/short-description.php):
<?php echo do_shortcode("[contact-form-7 id='8' title='Contact form 1']"); ?>
To get the title of Product’s Page I’ve added these fields to CF7:
MODULE tab:
[dynamichidden prod “CF7_get_post_var key=’title'”]
MAIL tab:
[prod]
ref: http://wptips.me/how-to-add-dynamic-values-into-contact-form-7-inputs/
-
This reply was modified 8 years, 3 months ago by
bipolab.