WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using the following wordpress theme, which is pretty cool btw.: http://demo.s5themes.com/?theme=simplecorp

Now the site has a custom Theme Options build in, where you can specify all the content inside the Dashboard(eg. For the contact page, you fill in your details on the dashboard theme editor.

Now my issue is the following:

When I add any additional content to the contact page inside the Contact Page itself, under Pages>contact page, whatever content I add there gets added to the TOP of the contact form template content. i would like to add it below. What do I need to change?

Below is the code form my contact page template:

 * Template Name: Contact Form Page
if(isset($_POST['submitted'])) {
        //Check to make sure that the name field is not empty
        if(trim($_POST['contactName']) === '') {
            $nameError = __("You forgot to enter your name.", "site5framework");
            $hasError = true;
        } else {
            $name = trim($_POST['contactName']);

        //Check to make sure sure that a valid email address is submitted
        if(trim($_POST['email']) === '')  {
            $emailError = __("You forgot to enter your email address.", "site5framework");
            $hasError = true;
        } else if (!eregi("^[A-Z0-9._%-]+@[A-Z0-9._%-]+\.[A-Z]{2,4}$", trim($_POST['email']))) {
            $emailError = __("You entered an invalid email address.", "site5framework");
            $hasError = true;
        } else {
            $email = trim($_POST['email']);

        //Check to make sure comments were entered
        if(trim($_POST['comments']) === '') {
            $commentError = __("You forgot to enter your comments.", "site5framework");
            $hasError = true;
        } else {
            if(function_exists('stripslashes')) {
                $comments = stripslashes(trim($_POST['comments']));
            } else {
                $comments = trim($_POST['comments']);

        //If there is no error, send the email
        if(!isset($hasError)) {
            $msg .= "------------User Info------------ \r\n"; //Title
            $msg .= "User IP: ".$_SERVER["REMOTE_ADDR"]."\r\n"; //Sender's IP
            $msg .= "Browser Info: ".$_SERVER["HTTP_USER_AGENT"]."\r\n"; //User agent
            $msg .= "Referrer: ".$_SERVER["HTTP_REFERER"]; //Referrer

            $emailTo = ''.of_get_option('sc_contact_email').'';
            $subject = 'Contact Form Submission From '.$name;
            $body = "Name: $name \n\nEmail: $email \n\nMessage: $comments \n\n $msg";
            $headers = 'From: '.$name.' <'.$email.'>' . "\r\n" . 'Reply-To: ' . $email;

            if(mail($emailTo, $subject, $body, $headers)) $emailSent = true;



            <div id="content" class="container clearfix">

                <!-- page header -->
                <div class="container clearfix ">

                    <?php if(of_get_option('sc_contact_map') != '') { ?>
                        <!-- contact map -->
                        <div id="contact-map">
                        <?php echo of_get_option('sc_contact_map') ?>
                        <!-- end contact map -->
                    <?php } else if(of_get_option('sc_showpageheader') == '1' &&  get_post_meta($post->ID, 'snbpd_ph_disabled', true) != 'on' ) : ?>

                        <?php if(get_post_meta($post->ID, 'snbpd_phitemlink', true)!= '') : ?>

                        $thumbId = get_image_id_by_link ( get_post_meta($post->ID, 'snbpd_phitemlink', true) );
                        $thumb = wp_get_attachment_image_src($thumbId, 'page-header', false);
                        <img class="intro-img" alt=" " src="<?php echo $thumb[0] ?>" alt="<?php the_title(); ?>"  />

                        <?php elseif (of_get_option('sc_pageheaderurl') !='' ): ?>

                            $thumbId = get_image_id_by_link ( of_get_option('sc_pageheaderurl') );
                            $thumb = wp_get_attachment_image_src($thumbId, 'page-header', false);
                            <img class="intro-img" alt=" " src="<?php echo $thumb[0] ?>" alt="<?php the_title(); ?>"  />

                        <?php else: ?>

                            <img class="intro-img" alt=" " src="<?php echo get_template_directory_uri(); ?>/library/images/inner-page-bg.jpg" />

                        <?php endif ?>
                    <?php endif ?>


                <!-- content -->
                <div class="container">

                    <h1><?php the_title(); ?> <?php if ( !get_post_meta($post->ID, 'snbpd_pagedesc', true)== '') { ?>/<?php }?> <span><?php echo get_post_meta($post->ID, 'snbpd_pagedesc', true); ?></span></h1>

                    <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">

                        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

                            <div class="page-body clearfix">
                                <?php the_content(); ?>

                            <div class="one-third">
                                <div class="caddress"><strong><?php _e('Address:', 'site5framework') ?></strong> <?php echo of_get_option('sc_contact_address') ?></div>
                                <div class="cphone"><strong><?php _e('Phone:', 'site5framework') ?></strong> <?php echo of_get_option('sc_contact_phone') ?></div>
                                <div class="cphone"><strong><?php _e('Fax:', 'site5framework') ?></strong> <?php echo of_get_option('sc_contact_fax') ?></div>
                                <div class="cemail"><strong><?php _e('E-mail:', 'site5framework') ?></strong> <a href="mailto:<?php echo of_get_option('sc_contact_email') ?>"><?php echo of_get_option('sc_contact_email') ?></a></div>


                            <div class="two-third last">
                                <div id="messages">
                                    <p class="simple-error error" <?php if($hasError != '') echo 'style="display:block;"'; ?>><?php _e('There was an error submitting the form.', 'site5framework'); ?></p>

                                    <p class="simple-success thanks"><?php _e('<strong>Thanks!</strong> Your email was successfully sent. We should be in touch soon.', 'site5framework'); ?></p>

                                <form id="contactForm" method="POST">
                                    <div class="one-third">
                                        <label for="nameinput"><?php _e("Your name", "site5framework"); ?></label>
                                        <input type="text" id="nameinput" name="contactName" value="<?php if(isset($_POST['contactName'])) echo $_POST['contactName'];?>" class="requiredField"/>
                                        <span class="error" <?php if($nameError != '') echo 'style="display:block;"'; ?>><?php _e("You forgot to enter your name.", "site5framework");?></span>
                                    <div class="one-third last">
                                        <label for="emailinput"><?php _e("Your email", "site5framework"); ?></label>
                                            <input type="text" id="emailinput" name="email" value="<?php if(isset($_POST['email']))  echo $_POST['email'];?>" class="requiredField email"/>
                                          <span class="error" <?php if($emailError != '') echo 'style="display:block;"'; ?>><?php _e("You forgot to enter your email address.", "site5framework");?></span>
                                    <div class="two-third">
                                        <label for="nameinput"><?php _e("Area/Rep", "site5framework"); ?></label>
                                            <option>Area 1 - Engela</option>
                                            <option>Area 2 - Francois</option>
                                            <option>Area 3 - Johan</option>
                                    <div class="two-third">
                                    <label for="Mymessage"><?php _e("Your message", "site5framework"); ?></label>
                                        <textarea cols="20" rows="20" id="Mymessage" name="comments" class="requiredField"><?php if(isset($_POST['comments'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['comments']); } else { echo $_POST['comments']; } } ?></textarea>
                                          <span class="error" <?php if($commentError != '') echo 'style="display:block;"'; ?>><?php _e("You forgot to enter your comments.", "site5framework");?></span>
                                    <br class="clear" />
                                    <input type="hidden" name="submitted" id="submitted" value="true" />
                                    <button type="submit" id="submitbutton" class="button small round orange"><?php _e(' &nbsp;SEND MESSAGE&nbsp; ', 'site5framework'); ?></button>



                        <?php endwhile; ?>

                    <?php else : ?>

                    <article id="post-not-found">
                            <h1><?php _e("Not Found", "site5framework"); ?></h1>
                        <section class="post_content">
                            <p><?php _e("Sorry, but the requested resource was not found on this site.", "site5framework"); ?></p>

                    <?php endif; ?>


            </div> <!-- end content -->

            <?php get_footer(); ?>
share|improve this question
Be aware anyone can inject additional headers into this form. For example Bcc to send spam in your name. – toscho Apr 23 '13 at 15:17
thank you , but how do I prevent this? – David Van Staden Apr 23 '13 at 19:16
Check all fields for illegal characters like line-breaks. But honestly … please don’t use that form. At a first glance I can find at least a dozen further problems. – toscho Apr 23 '13 at 20:13
it is a contact form provided by the plugin. Why would they make such a weak form? I don't really want to build a custom form, since I am designing the site for a client that does not have coding experience...Should I perhaps use another plugin? – David Van Staden Apr 24 '13 at 7:59
Yes, use another plugin. – toscho Apr 24 '13 at 8:59
up vote 2 down vote accepted
<?php the_content(); ?>

That's the function that displays everything you saved in Pages - > Contact Page. You just need to move that anywhere you would like.

Just keep in mind the_content() must be between the while loop for it to work.

<?php if (have_posts()) : while (have_posts()) : the_post(); ?> // Begins loop

<?php endwhile; ?> // ends while loop
share|improve this answer
thank you gDaniel, really appreciate!! – David Van Staden Apr 23 '13 at 19:23

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.