Contact us page is important for every website. Many wordpress developers use the contact7 wordpress plugin for creating the contact page.
Dont use the plugins for contact us page in wordpress
If you use any contact us plugin then your site became little bit slow. because due to database custom quires you will some bandwidth. My suggestion is use simple php code for that.
You need to just create the contact.php page in your wordpress theme folder and put the following code in that file.
<?php
/*
Template Name: Contact Us
*/
if($_POST[sent]){
$error = "";
if(!trim($_POST[your_name])){
$error .= "<p>Please enter your name</p>";
}
if(!filter_var(trim($_POST[your_email]),FILTER_VALIDATE_EMAIL)){
$error .= "<p>Please enter a valid email address</p>";
}
if(!trim($_POST[your_message])){
$error .= "<p>Please enter a message</p>";
}
if(!trim($_POST[your_subject])){
$error .= "<p>Please enter a message</p>";
}
if(!$error){
$email = wp_mail(get_option("admin_email"),trim($_POST[your_name])." sent you a message from ".get_option("blogname"),stripslashes(trim($_POST[your_message])),"From: ".trim($_POST[your_name])." <".trim($_POST[your_email]).">\r\nReply-To:".trim($_POST[your_email]));
}
}
?>
<?php get_header(); ?>
<section id="primary">
<div id="content" role="main">
<div id="archives">
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h1><?php the_title(); ?></h1>
<div>
<?php if($email){ ?>
<p><strong>Message succesfully sent. I'll reply as soon as I can</strong></p>
<?php } else { if($error) { ?>
<p><strong>Your messange hasn't been sent</strong><p>
<?php echo $error; ?>
<?php } else { the_content(); } ?>
<form action="<?php the_permalink(); ?>" id="contact_me" method="post">
<input type="hidden" name="sent" id="sent" value="1" />
<div id="form">
<div id="lebel">Your Name (required)</div>
<div id="input-field"><input type="text" name="your_name" id="your_name" value="<?php echo $_POST[your_name];?>" /></div>
<div id="lebel">Your Email (required)</div>
<div id="input-field"><input type="text" name="your_email" id="your_email" value="<?php echo $_POST[your_email];?>" /></div>
<div id="lebel">Subject</div>
<div id="input-field"><input type="text" name="your_subject" id="your_subject" value="<?php echo $_POST[your_subject];?>" /></div>
<div id="lebel">Your Message(required)</div>
<div id="input-field"><textarea name="your_message" id="your_message"><?php echo stripslashes($_POST[your_message]); ?></textarea></div>
<div id="lebel"> </div>
<div id="input-field"><input type="submit" name = "send" value = "Contact Us" /></div>
</div>
</form>
<?php } ?>
</div><!-- .entry-content -->
</div><!-- #post-## -->
<?php endwhile; ?>
</div>
</div><!-- #content -->
</section><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
If you need more information about then check following articles.
http://wordpressapi.com/2010/11/26/create-contact-page-wihout-wordpress-plugin/
http://wordpressapi.com/2010/11/24/send-smtp-email-wordpress-plugin/
Incoming search terms:
- contact us template
- contact us page template
- wordpress contact us page template
- contact template wordpress
- wordpress contact page template
- wordpress contact template
- contact Page template wordpress
- contact us template wordpress
- google api contact us form for wordpress
- contact us wordpress page template
- contact us wordpress template
- how to add php code in wordpress contact us page
- wordpress about us page template
- contact wordpress template
- contact us
- wordpress contact php kodu
- wordpress contact details template
- how to create a contact us php in wordpress
- how to create contact page in wordpress
- wordpress pages template $_post






Great wordpress hack for creating contact us page
I just sent this post to a bunch of my friends as I agree with most of what you’re saying here and the way you’ve presented it is awesome.
Intriguing post. I have been searching for some good resources for solar panels and discovered your blog. Planning to bookmark this one!
Of course, what a great site and informative posts, I will add backlink – bookmark this site? Regards, Reader
How do I send this information to a databse instead – basically I would like to send to database, receive a notification and also send email to the person that contact me. Could this be achieved at one go? Thanks!
Interesting read, perhaps the best article iv’e browse today. We learn everyday cheers to you!
I was just having a conversation over this I am glad I came across this it cleared some of the questions I had.
this works great thank you, but in the boxes appears the code. how do i stop the code form shoing the the boxes?