Advertisement
Guest User

Untitled

a guest
Apr 12th, 2015
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 3.42 KB | None | 0 0
  1. <?php
  2. /*
  3. Template name: Contact page
  4. */
  5. get_header();
  6. the_post();
  7. global $voxis_options;
  8. if(isset($_POST['postComment']) ) {
  9.     if( !$_POST['vox_name'] || !$_POST['vox_email'] || !$_POST['vox_message'] || $_POST['vox_name'] == '' ||
  10.         $_POST['vox_email'] == ''  || $_POST['vox_message'] == '' ) {
  11.         $error = 'Please fill in all the required fields';
  12.     }
  13.     else
  14.     {
  15.         //everything's fine, we continue with sending the e-mail
  16.         $name = esc_html($_POST['vox_name']);
  17.         $email = esc_html($_POST['vox_email']);
  18.         $message = esc_html($_POST['vox_message']);
  19.         $msg = 'Name: ' . $name . PHP_EOL;
  20.         $msg .= 'E-mail: ' . $email . PHP_EOL;
  21.         $msg .= 'Message: ' . $message;
  22.         $to = $voxis_options['email'];
  23.         $sitename = get_bloginfo('name');
  24.         $subject = '[' . $sitename . ']' . ' New Message';
  25.         $headers = 'From: ' . $name . ' <' . $email . '>' . PHP_EOL;
  26.         wp_mail($to, $subject, $msg, $headers);
  27.         $ok = "Message succesfully sent";
  28.     }
  29. }
  30. ?>
  31. <div id="main">
  32.     <div class='container'>
  33.         <div class='row'>
  34.             <div class='content span8 blog-page'>
  35.             <?php if ( function_exists('yoast_breadcrumb') ) {
  36. yoast_breadcrumb('<p id="breadcrumbs">','</p>');
  37. } ?>
  38.                 <article>
  39.                     <h1 class='title'><?php the_title();?></h1>
  40.                     <div class='blog-content'>
  41.                         <?php the_content();?>
  42.                         <div class="clear"></div>
  43.                         <div class="contact-form">
  44.                             <?php if(isset($error) && $error != '') { ?>
  45.                                 <div class="alert alert-error">
  46.                                     <div class="inner-alert">
  47.                                         <?php echo $error;?>
  48.                                     </div>
  49.                                 </div>
  50.                             <?php } ?>
  51.  
  52.                             <?php if(isset($ok ) && $ok != '') { ?>
  53.                                 <div class="alert alert-success">
  54.                                     <div class="inner-alert">
  55.                                         <?php echo $ok;?>
  56.                                     </div>
  57.                                 </div>
  58.                             <?php } ?>
  59.  
  60.                             <form id="commentform" class="contactform" method="post" action="<?php echo(get_permalink($post->ID)); ?>">
  61.                                 <input id="name" type="text" name='vox_name' placeholder="<?php _e('Your name ...', 'Voxis');?>" class='span5 contact-input'/>
  62.                                 <input id="email" type="email" name='vox_email' placeholder="<?php _e('Your email ...', 'Voxis');?> " class='span5 contact-input' />
  63.                                 <textarea id="message" name="vox_message" rows="10" class='span7 contact-input' placeholder="<?php _e('Your message ...', 'Voxis');?>"></textarea>
  64.                                 <input id="send_message" type="submit" name="postComment" value='<?php _e('Send Message', 'Voxis');?>' class='btn btn-custom btn-red btn-medium btn-large-text' />
  65.                             <?php do_action( 'recaptcha_print' )
  66.                             $recaptcha_is_valid = apply_filters( 'recaptcha_valid' , null ) !== false;
  67.  
  68. // $recaptcha_is_valid will be true when either no captcha is required (e.g. for logged in users) or the captcha is tested successfully.
  69.                             ?>
  70.                            
  71.                             </form>
  72.                         </div>
  73.                     </div>
  74.  
  75.                 </article>
  76.             </div>
  77.         </div>
  78.     </div>
  79. </div>
  80. <?php get_footer();?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement