您可以使用一个简单的表单获取客户对产品的评论,并通过邮件重播。
这是我很久以前用过的东西,我应该帮你做这项工作,它是一个简单的表单,只需稍加验证,只需更改:将您的邮件发送到您的邮件地址
if (isset ($_post[\'submit\'] && $post_[\'my_action\'] == \'product_comment\'){
if (wp_verify_nonce($_POST[\'product_comment\'],\'p_comment\')){
global $post;
$error = false;
$em = array();
if (!isset($_post[\'pc_name\'])){
$em[] = __(\'Name\');
$error = true;
}
if (!isset($_post[\'pc_email\'])){
if ($error){$em[] = __(\', Email\');
}else{
$error = true;
$em[] = __(\', Email\');
}
}
if (!isset($_post[\'pc_phone\'])){
if ($error){$em[] = __(\', Phone\');}
else{
$em[] = __(\'Phone\');
$error = true;
}
}
if (!isset($_post[\'cp_feedback\'])){
if ($error){$em[] = __(\', Your Feedback\');
}
else{
$em[] = __(\'Your Feedback\');
$error = true;
}
}
if (!$error){
$subject = \'New \'. $post->post_title . \' Feedback\';
$M = "Name: $_post[\'pc_name\'] \\n
Email: $_post[\'pc_email\']\\n
Phone: $_post[\'pc_phone\']\\n
Feedback: $_post[\'cp_feedback\']";
wp_mail(\'Your_mail\',$subject, $M);
}
}else{
$em[] = \'squrity error\';
$error = true;
}
}
<h3><?php _e(\'Leave Your Feedback\'); ?></h3>
<?php if($error){
echo _e(\'please correct the following: <br/>\');
foreach ($em as $e){
echo $e;
}} ?>
<form id="product-comment" name="product-comment" action="" method="post">
<p><?php _e(\'Name\'); ?></p>
<p><input type="text" name="pc_name" id="pc_name"></p>
<p><?php _e(\'Email\'); ?></p>
<p><input type="text" name="pc_email" id="pc_email"></p>
<p><?php _e(\'phone\'); ?></p>
<p><input type="text" name="pc_phone" id="pc_phone"></p>
<p><?php _e(\'Your Feedback\'); ?></p>
<textarea tabindex="4" rows="13" cols="50%" id="cp_feedback" name="cp_feedback"></textarea>
<?php wp_nonce_field(\'update-p_comment\',\'product_comment\'); ?>
<input type="hidden" name="my_action" value="product_comment">
<input type="submit" name="submit" value="send">
</form>