wordpress - Custom post type to work with html auto reply -
i'm trying setup custom post type landing pages in wordpress, including option customize text html auto response email.
i able call post meta on different page using using following loop, can't figure out how put in format works in html auto response.
is possible turn following loop ". $_post['content'] ."
or more appropriate?
<?php $args = array( 'post_type' => 'landing_pages'); $loop = new wp_query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); echo esc_html( get_post_meta( get_the_id(), 'landing_pages_short_description', true ) ); endwhile; wp_reset_query(); ?>
here html auto response
<?php if(!empty($_post['rev_captcha'])) { die('nice try robot. nothing here.'); } $autoresponse = true; $autoresponsesubject = "brand name: copy of message"; $autoresponsemessage = "<html> <head> <title>brand name: copy of message</title> </head> <body> <table cellpadding='0' cellspacing='0' width='100%' border='0' bgcolor='#f0f3f5' style='margin:0;padding:0;padding-bottom:15px;width:100%!important;height:100%!important;line-height:100%!important;background:#f0f3f5'> <tbody> <tr> <td width='100%' height='110px' valign='top'> <table cellpadding='0' cellspacing='0' width='95%' border='0' align='center'> <tbody> <tr> <td width='40%' align='center' style='padding:25px 0 0'> <img src='' width='160' height='55' alt=''> </td> <td width='60%' style='padding:40px 0 0'> </td> </tr> </tbody> </table> </td> </tr> <tr> <td width='100%' valign='top' align='center'> <table cellpadding='0' cellspacing='0' border='0' align='center' width='95%' bgcolor='#ffffff' style='background:#ffffff;padding-top:0px;border:1px solid #eeeeee;border-top:none' valign='top'> <tbody> <tr> <td align='center' style='padding-bottom:30px;padding-top:50px;border-bottom:1px solid #eeeeee'> <p style=\"font-family:'helvetica neue',arial,sans-serif;font-size:14px;color:#444444;margin:0 30px 5px;padding-top:10px;line-height:1.5\"> <strong style=\"font-family:'helvetica neue',arial,sans-serif;font-size:32px;line-height:30px;color:#444444\">good news, ". $_post['name'] ."!</strong></p> <p style=\"font-family:'helvetica neue',arial,sans-serif;font-size:14px;color:#444444;margin:0;padding: 10px 50px 30px;line-height:1.5;text-align:center\">your message has been sent.</p> <p style=\"font-family:'helvetica neue',arial,sans-serif;font-size:14px;color:#444444;margin:0;padding: 10px 50px 0;line-height:1.5;text-align:left\">here copy records:</p> <p style=\"font-family:'helvetica neue',arial,sans-serif;font-size:14px;color:#444444;margin:10px 0 10px 52px;padding:0 50px 0 20px;border-left:4px solid #666666;line-height:1.5;text-align:left\"><em>". $_post['notes'] ."<br>--<br>". $_post['name'] ."<br>". $_post['phone'] ."<br>". $_post['email'] ."</em></p> <br> <p style=\"font-family:'helvetica neue',arial,sans-serif;font-size:14px;color:#444444;margin:0;padding: 10px 50px 0;line-height:1.5;text-align:left\">sent from: ". $_post['referrer'] ."</p> </td> </tr> <tr> <td align='center'> <p style=\"font-family:'helvetica neue',arial,sans-serif;font-size:14px;color:#888888;line-height:1.3;padding:10px 50px\">thanks contacting</p> </td> </tr> </tbody> </table> </td> </tr> </tbody> </table> "; $autoresponseheaders = "from: ___@___.ca"."\r\n"; $autoresponseheaders .= "mime-version: 1.0"."\r\n"; $autoresponseheaders .= "content-type: text/html; charset=iso-8859-1"."\r\n"; $email_to = $_post['email']; $name = $_post['name']; $phone = $_post['phone']; $notes = $_post['notes']; $referrer = $_post['referrer']; $time = date('f j, y g:i:s t', time()); $message = "from: $name "."\r\n"."email: $email_to "."\r\n"."time: $time "."\r\n"; $headers = "from: $email_to"."\r\n"; $headers .= "reply-to: $email_to"."\r\n"; if(mail('___@___.ca', 'brand name', $notes . "\r\n \r\n" . $name . "\r\n". $phone . "\r\n". $email_to . "\r\n \r\n" . 'sent from: ' . $referrer , $headers)){ if($autoresponse === true){ mail($email_to, $autoresponsesubject, $autoresponsemessage, $autoresponseheaders); } header("location:/sent.php" ); // send proper page when done. }else{ echo 'failed';// ... or 1 tell it wasn't sent } ?>
on file single-landing_page.php
create hidden form field
<input type="hidden" name="custom_postmeta" value="<?php echo esc_html( get_post_meta( get_the_id(), 'landing_pages_short_description', true ) ); ?>" />
then on other file other fields can hidden field
$custompostmeta = $_post['custom_postmeta'];
then concatinate $custompostmeta
variable within html table hope work
Comments
Post a Comment