I did as the direction requested and I have text in the fields on the site Can someone tell me what I did wrong I don't have a twenty twelve theme I have a twenty fifteen theme. I did all as directions said placed a folder in the wp-content/theme named contact-form then I placed the code below in the style.css
Theme Name: Contact Form Page Template
Theme URI:
Description: A super simple, self-contained contact form you can drop into your existing theme.

Author: Harley
Author URI:
Template: twentyfifteen
Version: 0.1

I don't know whats wrong can anyone help me please.
@import url("../twentytfifteen/style.css":wink:;

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hey there, Vincent!

    I'm not sure what's happening here, I'm not able to reproduce it. I'm going to ask you to try the pre-packaged version of the child theme that was attached to the original blog post, I'll attach it here as well. I think you may have missed one of the steps later on in the original tutorial. I've already made the changes to styles.css to work with twentyfifteen instead of twentytwelve, and it's working on my site.

    1. Download the attached zip file.
    2. Install via Upload New Theme, and activate.
    3. Check your page and see if you see the correct form.

    Thanks, Vincent!

  • Vincent
    • The Incredible Code Injector

    It is still not working I had used the two files you gave me and they are not working.
    Below is whats in my wp-content/themes/contact-form/page-contact-us.php
    and the wp-content/themes/contact-form/style.css
    Theme Name: Contact Form Page Template
    Theme URI:
    Description: A super simple, self-contained contact form you can drop into your existing theme.
    Author: Harley
    Author URI:
    Template: twentyfifteen
    Version: 0.1

    @import url("../twentyfifteen/style.css");


    //response generation function

    $response = "";

    //function to generate response
    function my_contact_form_generate_response($type, $message){

    global $response;

    if($type == "success") $response = "<div class='success'>{$message}</div>";
    else $response = "<div class='error'>{$message}</div>";


    //response messages
    $not_human = "Human verification incorrect.";
    $missing_content = "Please supply all information.";
    $email_invalid = "Email Address Invalid.";
    $message_unsent = "Message was not sent. Try Again.";
    $message_sent = "Thanks! Your message has been sent.";

    //user posted variables
    $name = $_POST['message_name'];
    $email = $_POST['message_email'];
    $message = $_POST['message_text'];
    $human = $_POST['message_human'];

    //php mailer variables
    $to = get_option('admin_email');
    $subject = "Someone sent a message from ".get_bloginfo('name');
    $headers = 'From: '. $email . "\r\n" .
    'Reply-To: ' . $email . "\r\n";

    if(!$human == 0){
    if($human != 2) my_contact_form_generate_response("error", $not_human); //not human!
    else {

    //validate email
    if(!filter_var($email, FILTER_VALIDATE_EMAIL))
    my_contact_form_generate_response("error", $email_invalid);
    else //email is valid
    //validate presence of name and message
    if(empty($name) || empty($message)){
    my_contact_form_generate_response("error", $missing_content);
    else //ready to go!
    $sent = wp_mail($to, $subject, strip_tags($message), $headers);
    if($sent) my_contact_form_generate_response("success", $message_sent); //message sent!
    else my_contact_form_generate_response("error", $message_unsent); //message wasn't sent
    else if ($_POST['submitted']) my_contact_form_generate_response("error", $missing_content);


    <?php get_header(); ?>

    <div id="primary" class="site-content">
    <div id="content" role="main">

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

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

    <header class="entry-header">
    <h1 class="entry-title"><?php the_title(); ?></h1>

    <div class="entry-content">
    <?php the_content(); ?>

    <style type="text/css">
    padding: 5px 9px;
    border: 1px solid red;
    color: red;
    border-radius: 3px;

    padding: 5px 9px;
    border: 1px solid green;
    color: green;
    border-radius: 3px;

    form span{
    color: red;

    <div id="respond">
    <?php echo $response; ?>
    <form action="<?php the_permalink(); ?>" method="post">
    <p><label for="name">Name: <span>*</span> <input type="text" name="message_name" value="<?php echo esc_attr($_POST['message_name']); ?>"></label></p>
    <p><label for="message_email">Email: <span>*</span> <input type="text" name="message_email" value="<?php echo esc_attr($_POST['message_email']); ?>"></label></p>
    <p><label for="message_text">Message: <span>*</span> <textarea type="text" name="message_text"><?php echo esc_textarea($_POST['message_text']); ?></textarea></label></p>
    <p><label for="message_human">Human Verification: <span>*</span> <input type="text" style="width: 60px;" name="message_human"> + 3 = 5</label></p>
    <input type="hidden" name="submitted" value="1">
    <p><input type="submit"></p>

    </div><!-- .entry-content -->

    </article><!-- #post -->

    <?php endwhile; // end of the loop. ?>

    </div><!-- #content -->
    </div><!-- #primary -->

    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    P.S I fallowed the directions whats wrong.
    As you can see the site is not working there is scripts in the fields.

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hey there, Vincent!

    Two possible things to try:
    1. What version of PHP is running on your server?
    2. Are you using any other plugins on the site you're trying to add the contact form to? If so, can you try disabling them and see if you get blank fields without the PHP code in them?

    The code you have here is fine, it matches what I have exactly. There must be something else going on here.

    Ultimately, this method of importing the settings into a child theme is outdated, but I'm not sure what the workaround would be to create a child theme for this while following the proper procedure. Don't worry about that now, let's just see if we can make it work. :slight_smile:

  • Vincent
    • The Incredible Code Injector

    Tell me how to start over I have your files and I have created two files style.css and page-contact-us.php

    What do I do with the script in your files your first step is confusing in your directions to pad it out what dose this mean.
    You make this so confusing if I left my page-contact-us.php blank That’s alright though! Quickly pad it out with the following, and it will look just like a normal page again.

    This is confusing I must say.

    Why don't you tell me what to do with the two files you sent me or should I leave them empty and then place what code in them. Your script was fallowed directly.
    I created two files a style.css and a page-contact-us.php in the wp-content/themes
    Then I placed your css that was in your files style.css into my file style.css
    Then I placed the scripts in the file page-contact-us.php then I placed the other script after that were it says the Replace the FORM CODE GOES HERE paragraph with the following:
    I use the script below and took out form goes here and placed the script below that you have there in between the two <P>script</p>
    What else is ther to do

  • Michelle Shull
    • DEV MAN’s Apprentice

    Hi there, Vincent.

    I see the problem.

    The two files I gave you should go into a folder called contact-form in your themes folder. Do not copy the CSS to your style.css folder, leave it in the contact-form folder, next to page-contact-us.php.

    OR, delete both of those files and do the following.

    1. Go to Themes > Add New > Upload Theme

    2. Select the zip file I gave you from your local computer from the upload screen. DO NOT UNZIP FIRST.

    3. Activate the child theme from Appearances > Themes.

    That will make it work. :slight_smile:

  • Vincent
    • The Incredible Code Injector

    I don't know what you mean child theme I have three themes in there called twenty fifteen twenty fourteen twenty thirteen. The active theme right now is twenty fifteen.
    I am lost ok lets start this over I have deleted the files in the themes section.
    Now what am I suppose to do with this twenty fifteen theme. Upload what theme the theme already in there. Do you want me to deactivate it and activate it again you are confusing me.

    Regards Vinny

    Regards Vinny

  • Jude
    • DEV MAN

    Sorry the response took a while longer than expected. Appreciate your patience. Looks like Michelle is really busy and this one slipped through the gaps, I'm gonna take the liberty of chipping in here.

    You can read more about child themes here

    At this point I'd really recommend you just get a simple plugin to help with this you can try

    OR use Jetpack

    I say this because you'd save a lot of time you can use elsewhere as opposed to coding one from scratch


  • CaiCer
    • New Recruit

    Well, I'm having a problem here, too. The tutorial states "You can take out the custom page template and drop it into any of your current themes, and it should work flawlessly (bar some CSS modifications).", but I have not been able to do this. I'm receiving similar errors to Vincent it seems, such as:

    Undefined index: message_name in /...../wp-content/themes/childtheme/contact-us.php on line 31

    The same error shows when I name the "contact-us.php" file "page-contact-us.php".

    Here is what I did, please let me know where I went wrong.
    1. I placed the page-contact-us.php code onto my website as contact-us.php in "/...../wp-content/themes/childtheme/contact-us.php".
    2. I placed template headings in the file as I did in my other templates. So, after the opening PHP tags I now have:
    * Template Name: Contact Us Template
    * @package WordPress
    * @subpackage UnderStrap Child (this is the child theme I'm using. Other templates in this folder are working properly).
    3. I made a new page via the admin dashboard called contact-us, accessible via and used this template.

    A page was not created when I named the file page-contact-us.php in my themes/child/ path, hence implementing this via a template.

    Soooooooo where did I go wrong? Thanks!

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.