Secure and Accessible PHP Contact Form on Wordpress

I am making changes to my blog theme and layout recently. I have decided also to set up a Contact Form on my blog. I selected the Secure and Accessible PHP Contact Form v.2.0WP from Green-Beast.com.

I downloaded the plugin, activate it and configure it. The last step was to create a new page and insert the code <!--gb_contact_form--> into the new page. I did that but I just could not get it to work on my wordpress blog.

I consulted Mike and it is just weird that the rich text editor of my Wordpress is having some conflict with the auto parsing code of the contact form. Mike suggested me to create my own template for the contact form.

I did that and amazing, it works now.

So, I just think it might be good to document it down such that it can benefit some other people as well.

1. Create Contact.php Files inside Theme Folder

Start your FTP client, go to the Wordpress Theme folder and select the page.php, duplicate the file and rename the new file as contact.php. Chmod contact.php to 666.

Duplicate Page to Contact

2. Edit Contact.php using Wordpress Theme Editor

Login to Wordpress. open up the “Contact.php” file inside Wordpress Theme editor.

Wordpress Theme Editor

Insert the following code on top of the file.

 <?php
  /*
   Template Name: Contact
  */
 ?>

Scroll down to look for the <div id=”content”>, replace all the code of the loop to the following code.

 <?php 

  // FORM SHOWS NEXT
    gbcf_show();
 ?>

Click update to save the file.

3. Assign the Contact Template to the Contact Page

Create a new page called “Contact” or “Contact Me” using the Wordpress editor. Select the “Contact” template on the right hand side of the editor.

Contact Template

4. Save & Publish the Page

Do a chmod on the contact.php back to 644.

You are Done! You have a contact page on your blog now!

2 Responses to “Secure and Accessible PHP Contact Form on Wordpress”

  1. This is useful. Thanks for posting it. Two things I’d like to add. First the permissions only need to be set to 666 instead of 777 on the file so that’s what I’d suggest. I’d also recommend changing the permissions back to 644 once the editing is done. Just for increased security.

  2. Thanks Mike. I will updated the post.

Leave a Reply

You can use these XHTML tags: <a href="" title=""> <abbr title=""> <acronym title=""> <blockquote cite=""> <code> <em> <strong>