Posted on Leave a comment

The Ultimate Guide To Create Contact Form On WordPress

contact form on wordpress

Creating contact form is super easy in WordPress. Do a simple search and you can find tons of plugins available with 4.5+ star rating. You think that why do you need another tutorial, right? Well, for most people those plugins will work right out of the box and they can move on doing other important things. For some others, things are not so easy.

Maybe you have followed some tutorials, setup exactly as they said but still, the form doesn’t work. In other cases, you may want to add some tweaking to the look and feel of the form.

Whatever your reasons, my goal is to help you setup contact form for your website from scratch and make it work so you never miss an important message from your visitors.

Let’s get started.

Plugins to use

Before we begin, let’s have the following plugins ready:

  1. Contact Form 7 (required)
  2. Easy WP SMTP (required)
  3. Super simple grid (my plugin, optional if you want to have multiple columns form)
  4. Recaptcha V2 For Contact form 7 (optional but recommended)

Step 1: Create a contact form with contact form 7

The first step is to create a contact form with Contact form 7. You should have contact form 7 installed and activated for now.

If you look at your dashboard menu on the left, there should be an option called Contact:

The Ultimate Guide To Create Contact Form On WordPress 1

Click on that option, you’ll see contact form 7 screen:

The Ultimate Guide To Create Contact Form On WordPress 2

As you can see, there is already a form created for you. Go ahead and delete it as we are going to create a new form.

Click on the add new button at the top to add a new form.

The Ultimate Guide To Create Contact Form On WordPress 3

As you can see, there are three main things we are going to do with Contact form 7:

  1. Enter a form name (nearly the easiest thing)
  2. Add, remove fields to your form (hardest)
  3. Click on Save button to save your form (the easiest)

As the form name, you can enter anything you like. In case you need to have multiple contact form, the name should help you tell which for is which.

Now, let’s go ahead to configure the fields of our form.

Normally, a contact form should have the following fields:

  1. Contact name
  2. Contact email
  3. Subject
  4. Message

However, you can add more fields if you need to.

Contact form 7 support a variety of fields as you can see at the top of the form editor:

The Ultimate Guide To Create Contact Form On WordPress 4

As you can see, you can even add radio, checkboxes and even quizzes to the contact form, which is very great.

To add any field to your form, first, put the cursor where you want to insert the field, then click on the field you want to insert.

For example, I want to insert a confirmation checkbox below the message box, I click on the space below that message box:

The Ultimate Guide To Create Contact Form On WordPress 5

Then, click on acceptance button at the top:

The Ultimate Guide To Create Contact Form On WordPress 6

Configure the field before adding to your form

A window will show up for me to configure the field:

The Ultimate Guide To Create Contact Form On WordPress 7

There are a few things you need to pay attention to:

  1. Name: this should be human readable and it should tell you what the field is about. If you are adding a telephone field (tel), then you should name it tel, phone…
  2. Id and class: These fields are useful if you want to style them using CSS later. If you are happy with the default, leave them blank.
  3. Condition: this option is specific to acceptance field only
  4. Options: This option is specific to acceptance. In other fields, you will have the required checkbox to mark the field cannot be blank when submitting form.

Now, I have the form ready. I’m going to save it. After saving the form, there is a field appears:

The Ultimate Guide To Create Contact Form On WordPress 8

This is the shortcode. You can think of shortcode as a placeholder for a, usually, much bigger text. In this case, it’s our form.

This is the code we put in the contact page to display the contact form. Thus, let’s go ahead and put this code in a page.

If you are using Gutenberg editor, you should add a shortcode element first before putting the shortcode:

The Ultimate Guide To Create Contact Form On WordPress 9

In case you use the classic editor, you just paste the code in the page’s body.

Let’s publish the page and take a look at our form:

The Ultimate Guide To Create Contact Form On WordPress 10

As you can see, the form looks great and it has all the fields as added in contact form 7 form builder.

Step 2: Configure SMTP server to ensure mail delivery

Nowadays, most hosting providers offer mail function out of the box for PHP (the programing language behind WordPress). As a result, many of you may not have any problem get the contact message delivered to your inbox. However, if you have built your contact form, tried to submit a message but still didn’t see anything in your inbox, it’s time to configure your SMTP server.

Don’t worry about the jargons, it is very simple to fix mail sending problem in WordPress as I made a tutorial here:

The tutorial is for WooCommerce but it works for WordPress too.

Step 3: Put your form in multiple columns

Now you should have the form up and running. When someone submit the form, you should get a message in your inbox. That’s great!

However, what if you want to put the form in multiple columns? No worries, I got you covered!

Here is the detailed tutorial on how to put contact form 7 in multiple columns.

Step 4: Add recaptcha v2 to your form to prevent spam

Spam is a serious problem that any site owner has to face today. When you put up a form, you open a door to your inbox for spammer. Thus, adding captcha to your form is a great way to keep your inbox clean.

Now, let’s add the plugin Recatpcha V2 For contact form 7 to your site.

After you activate the plugin, you’ll see a new option under Contact form 7 menu:

The Ultimate Guide To Create Contact Form On WordPress 11

Click on that to start setting up Recaptcha.

The Ultimate Guide To Create Contact Form On WordPress 12

Select the options as in the screenshot and click on submit.

You are done on that screen. However, there in one extra step you need to do to make recaptcha works. That is integrate recaptcha with your site.

Still under Contact menu, click on Integration:

The Ultimate Guide To Create Contact Form On WordPress 13

You’ll see there is a box says reCaptcha. Click on setup integration button in that box to start integrating it to your site:

The Ultimate Guide To Create Contact Form On WordPress 14

The next screen is where you put reCaptcha keys:

The Ultimate Guide To Create Contact Form On WordPress 15

You may wonder, where do I get those keys? Don’t worry, I’ll walk you through that.

First go to this url:

https://www.google.com/recaptcha/admin/create

If you are not logged in to your gmail account, login first and try visiting that page again. You’ll see a screen like this:

The Ultimate Guide To Create Contact Form On WordPress 16

There are two recaptcha options at the time of this writing: v2 and v3. You should select v2, not v3 for this to work.

Make sure you add your domain at “add a domain, e.g. example”

Finally, click on Submit to finalize the process. As a result, you’ll see the keys available in the next screen:

The Ultimate Guide To Create Contact Form On WordPress 17

Now, copy them to put in the integration screen on your blog and you are done.

The Ultimate Guide To Create Contact Form On WordPress 18

Click on save changes to save the keys.

Now, there is one more thing you need to do. That is putting [recaptcha] tag to the contact form so the captcha will show up.

The Ultimate Guide To Create Contact Form On WordPress 19

And when I view the form, sure enough, recaptcha box is there:

Recaptcha is working on contact form 7 form

Conclusion

As you can see, setting up contact form on WordPress could be quite tricky. However, with the helps of plugins, it is much easier to create fully functional contact page. Hopefully the tutorial is helpful to you. If you need further assistance, don’t hesitate to drop me a message.

Posted on Leave a comment

How To Add Columns In Contact Form 7

contact form

Contact form 7 is a great plugin to build contact form for WordPress. In contrast to its super powerful functions, the look at feel of this form builder has been very basic through the years.

One of the most needed feature is to layout the contact form in multiple columns. This feature is available in many form builders. However, we still haven’t seen any sign of it get added to contact form 7.

If you need to layout your form in multiple columns, don’t worry, I got your back.

I will show you how to layout contact form 7 fields in as many columns as you like (well, may not as many as you want but sufficient for all your needs).

Let’s get started.

Step 1: install plugin to enable grid system on your site

We are going to install a plugin which I’ve made a few minutes ago to enable multiple columns layout on your site. My plugin uses a CSS framework called skeleton CSS to let you layout elements on multiple columns.

You are not limited to use this for laying out contact form 7 elements. You can use this for many other things you need.

Let’s download and install my plugin here:

https://www.dropbox.com/s/685l4umn4pi5k6v/super-simple-grid.zip?dl=0

Install and activate it then you are done. There isn’t anything to configure with my plugin. Isn’t that great 😉

Step 2: Putting contact form 7 elements to columns

Before we actually begin putting contact form 7 elements, I would like to introduce you to our grid system.

There are three elements of our system:

  1. Container (this is the outer most element)
  2. Row (represents a row)
  3. Column (represent a column)
Illustration of  contact form 7 grid
Illustration of contact form 7 grid

If you now HTML/CSS, this diagram is not strange to you.

Now, let’s create a simple form in contact form 7.

I’m not going to show you how to create a form since it’s very easy to do so. You’d probably know how to do that already.

This is my form code:

contact form 7 code

I’ll take the shortcode and put on a contact page. This is what I have:

How To Add Columns In Contact Form 7 20

You can see that, everything is in one column.

What if I want to put the email field to the right of the name field?

It is super simple. I’m going to:

  1. Add a container div that wrap the form
  2. Add a row at the top and inside that row, add two columns
  3. One column hosts the name field, the other hosts the email field
  4. I add another row. Inside that row, add one column that spans the whole row.
  5. Then, I put the rest of the form in that row

Here is the code:

contact form 7 code layout in multiple columns

The grid system is based on 12 columns layout. So, in the first row (.c7-row), you see that I have two columns, each spans six columns so they will occupy equal amount of space.

On the second row, I put everything in one column that span 12 columns. You can see that the class is twelve columns.

Now, save the form and let’s see the result:

How To Add Columns In Contact Form 7 21

Not surprisingly, we have the two fields: name and email laid out in a single row.

Conclusion

As you can see, it’s very simple to create a contact form 7 form that has multiple columns. Hope you now can create better contact form for your site.

If you have question, please ask. I’d love to hear your feedback.