
Create WordPress Pages
We'll start by creating both the essential pages required for our custom contact form. Let's go!Step 1: Create a Thank You page with the relevant text copy you want to display after a visitor has submitted the form. You can also add graphics on this page. It's entirely up to you what exactly you want to display on this page.
Once you've created a Thank You page, you can publish it instantly. Copy the URL of this page in a text editor. We'll need this URL later on while configuring the contact form.
Step 2: Create a Contact page, but do not publish it. Switch to post editor's Text mode as shown below.

Create a Google Drive Form
Once both the pages are created, we move on to the next step of creating a new Google Drive form which will be used to power our custom contact form.Step 3: Once within Google Drive, go to 'NEW → More → Google Forms' option to create a blank form. Add all the necessary fields present in a typical contact form. For example, Name, Email, Website, and Message. Except website information, make all other fields mandatory.
Do provide an appropriate title to the contact form. Once finished, your form editing screen may look something like this.

Setup Automatic Notifications
No contact form is complete unless you get submission notifications almost instantly. That's what we're going to set up in the next steps.Step 4: Go back to your Google Drive dashboard and create a blank spreadsheet by choosing the 'NEW → Google Sheets' option. Give this new spreadsheet a proper name of your choice.
Step 5: Go back to the form creation interface where you already have the completed contact form. Click the 'Responses → Choose response destination...' option as shown below.
Clicking this option will open a dialogue box asking to either create a new spreadsheet or select an existing spreadsheet. Choose the second option which in turn will open another box to select the spreadsheet you've already created in step 4. This will link the spreadsheet with your form facilitating the automated saving of information submitted via the form.


Embed Default Form Code Into Contact Page
It's time to grab the form code which will be pasted into the editor you're using to edit the contact page on your WordPress dashboard. Here's how to do it.Step 7: Go back to the form editing interface and click 'View live form' option. This will open the contact form in a new browser tab. Switch to that tab and right-click anywhere on the page. Choose 'View Source' or 'View Page Source' option from the context menu.
Step 8: Clicking this option will open the source code of the web page. Now comes the most important step of copying the form code from within this source code.
First, find the
<form action="https://....
opening form tag. Then find the closing </form>
tag. You have to copy the entire code starting from the opening form tag up to the closing form tag. Once copied, paste it right below the text you've written in the post editor as shown below.
Configure 'Thank You' Page
It's time to configure the setting for the Thank You page such that upon successful form submission, a visitor is directed to it to show a relevant message. Let's do it.Step 9: Start with pasting the following code, just above the opening form tag.
<script type="text/javascript">
var submitted=false;
</script><iframe
id="hidden_iframe"
name="hidden_iframe"
onload="if(submitted){window.location='Thank You Page URL Here';}"
style="display: none;"></iframe>
After pasting this snippet, the code will look something like this:
Step 10: In the opening form tag, you will find two attributes viz.,
target="_self"
and onsubmit=""
which needs to be changed.Replace both the default form attribute values with the new custom values. Replace them with
target="hidden_iframe"
and onsubmit="submitted=true;"
values which will ensure proper redirection to the Thank You page.Customize Form's Appearance
And last but not the least, we'll work on tweaking and in improving the default look and feel of the form. This step will involve some custom CSS code.Step 11: Paste the following CSS code right above the code you've pasted in step 9.
<style type='text/css'>
.required-message, .ss-password-warning { display: none; }
#navigation-table, #navigation-buttons { border: none; }
.ss-required-asterisk { width: 10px; display: block; margin: -65px 0px 0px 65px; }
.ss-paragraph-text span { margin-left: 85px; }
</style>
The final customized contact form will look like this when using the Twenty Fifteen theme.
Wrapping It Up
Once the custom Google Drive form is working on the contact page, make sure you do some dummy submissions to ensure it is working correctly. Do not accidentally delete the form and spreadsheet files from your Google Drive account.Hopefully, this method will help you in integrating a free and custom contact form on a WordPress site. You can use the same methodology on almost any content management system.