How do I add and use WordPress contact forms?
There are aĀ range of different WordPress form plugins out there such as WP Forms, Contact Form 7 and Pirate Forms.
In this example, we'll demonstrate with the free to use Contact Form 7 plugin.
1. Install the Contact Form 7 Plugin
Log in to your WordPress Admin area and head toĀ PluginsĀ and selectĀ Add New. Search forĀ Contact Form 7Ā and selectĀ Install NowĀ and thenĀ Activate.
2. Add a New Contact Form
Youāll now see a new menu option calledĀ ContactĀ down the left-hand WordPress sidebar. SelectĀ ContactĀ to configure a new form. Youāll see a list of current contact forms, with a default form called 'Contact form 1'Ā having already been added.
Weāll create a new one. SelectĀ Add New. You'll see the default form that's been added along with its default data.Ā
3. Configuring Your Form
Form tags are used as placeholders for a HTML form control. For example, you can add a drop-down menu using theĀ drop-down menuĀ tag. You can see our example below and how it effects the form on the site.
- Field typeĀ - This sets whether the field being added is required in order to submit the form.Ā
- Name -Ā This is the name of the form tag being added. It's only used internally so it won't affect how the form field is displayed on the website.Ā
- OptionsĀ - As this is a drop-down menu tag, there needs to be various options for the user to select. In our example we've used various ages.Ā
- Id attribute/Class attributeĀ - If you wantĀ to customise your form further, you can assign a CSS ID or Class attribute.
4. Edit the Mail Settings
Now you've configured your form, you'll want toĀ configure where the form actually sends from,Ā andĀ where it sends to. TheĀ FromĀ address will always need to be an address that uses your own domain, e.g. [email protected], however you can set theĀ ToĀ address to be any email address you want to receive the form to.Ā
You'll be able to configure what information from the form gets sent via the email, in the example above, you can see the tags:Ā [your-name], [your-email], [your-subject] and [your-message].Ā This will be the information the form user has entered into the form when they submitted it.Ā
5. Adding the Form To Your Site
Now you've configured the form, you can add it to a Post or Page on your WordPress site. To do this, you'll need the form shortcode which is provided on the Contact Form page.
In our example, our short code is:Ā
Add the shortcode.
Once done, your form will display on the page or post you've added it-to.Ā