WPBeginner

Beginner's Guide for WordPress

  • Blog
    • Beginners Guide
    • News
    • Opinion
    • Showcase
    • Themes
    • Tutorials
    • WordPress Plugins
  • Start Here
    • How to Start a Blog
    • Create a Website
    • Start an Online Store
    • Best Website Builder
    • Email Marketing
    • WordPress Hosting
    • Business Name Ideas
  • Deals
    • Bluehost Coupon
    • SiteGround Coupon
    • WP Engine Coupon
    • HostGator Coupon
    • Domain.com Coupon
    • Constant Contact
    • View All Deals »
  • Glossary
  • Videos
  • Products
X
☰
Beginner's Guide for WordPress / Start your WordPress Blog in minutes
Choosing the Best
WordPress Hosting
How to Easily
Install WordPress
Recommended
WordPress Plugins
View all Guides

WPBeginner» Blog» Tutorials» How to Add a Contact Form Popup in WordPress

How to Add a Contact Form Popup in WordPress

Last updated on July 15th, 2019 by Editorial Staff
196 Shares
Share
Tweet
Share
Pin
Free WordPress Video Tutorials on YouTube by WPBeginner
How to Add a Contact Form Popup in WordPress

Recently we got an email from a user asking: How do I put my contact form in a popup for my WordPress site? This is a common trend on many sites where when a user clicks on the contact button or link, instead of going to a new page, the contact form opens in a popup. In this article, we will show you how to add a contact form popup in WordPress that will work for just about any contact form plugins. We will also show you how to only open the popup when a user clicks on link or button to ensure the best user experience.

Creating a contact form popup in WordPress

To make it easy, we have created a video tutorial on how to add a contact form popup that you can watch below.

Subscribe to WPBeginner

However if you just want to follow text-instructions, then you can follow our step by step tutorial on how to how to add a contact form popup in WordPress.

Step 0: Getting Started

For this tutorial you will need to install and activate two plugins.

First, you need OptinMonster’s pro plan which comes with the Canvas form type. OptinMonster is the best WordPress popup plugin on the market and helps you convert website visitors into subscribers and customers.

Next, you will need to have a contact form plugin such as WPForms, Gravity Forms, Contact Form 7, etc.

For the sake of this article, we will be using the free version of our favorite contact form plugin: WPForms Lite.

We are assuming that you have installed and activated both plugins. If you need help, then see our step by step guide on how to install a WordPress plugin.

Disclaimer: WPForms and OptinMonsters are both created by WPBeginner’s Founder, Syed Balkhi.

Having said that, let’s move on to creating a contact form in WordPress.

Step 1: Creating a Contact Form using WPForms

First you need to create a new contact form with WPForms. If you already have a contact form created with WPForm, then you can skip this step.

Click on WPForms menu in your WordPress admin sidebar and then click on the Add New button.

Adding a new contact form in WordPress using WPForms

This will launch the Form Builder. Simply enter a name for your form, for e.g. ‘Contact Us’ and then click on ‘Simple Contact Form’ template to continue.

Setting up new contact form

The form builder will take you to the fields editor. You can add or remove fields from your form or rearrange them by simple drag and drop.

Editing contact form fields

Once you are done, you need to click on the save button to store your changes. Your contact form is now ready.

You need to visit WPForms » All Forms page. You will find your contact form listed there. Next to it you will find a shortcode. You will need this shortcode in the next step.

Contact Form Shortcode

If you need more detailed instructions, then checkout our step by step guide on how to create a contact form in WordPress.

Now that we have a contact form ready, let’s move on to the next step and create a lightbox popup in WordPress.

Step 2: Creating a WordPress Popup using OptinMonster

First thing we need to do is create a modal popup using OptinMonster.

You need to create a new optin by clicking on OptinMonster in WordPress admin menu, and then click on Create New Optin button.

New optin

This will take you to OptinMonster website, where you will create your popup. First you need to provide a title for your campaign. You can name it anything you want, for e.g. ‘Contact Form popup’.

Setup your optin

Next you need to select your website from the drop down menu. Click on Canvas under ‘Select Your Design’ option.

OptinMonster will show you available templates. Currently, there is only Whiteboard template available for Canvas. Click on template to continue.

This will bring you to Optin Customizer screen. You will notice that Canvas is blank by design. It’s done that way, so you can add just about anything you want while using the power of OptinMonster. You can add a signup form, facebook like box, surveys, coupon codes, or like we’re doing in this example a contact form.

Adding custom CSS and HTML to canvas optin

Under the design tab you can choose the height width of your canvas. By default, it is set to 700 x 350 px. Let’s set the height to 520 at least.

Under the ‘Custom HTML’ box you will enter your contact form shortcode along with any other custom HTML you may want to add.

Here is a sample HTML we used to create the modal popup for this tutorial.

<h3>Do You Have Any Questions?</h3>
<p class="tagline">Want to ask us more about our services? Simply fill out this form and we will get back to you as soon as possible. </p> 
[wpforms id="119"]

Notice that we have embedded the WPForms shortcode in there as well. If you are using another contact form, then simply replace the shortcode with your contact form shortcode.

After the custom HTML, the next option is to enter your custom CSS. Below the custom CSS box, you will see a string of random text that looks like this html div#om-mw7pzo63ch6wpfzi. This is the CSS prefix you will be using in your custom CSS.

Here is the CSS we used to create the modal popup for this tutorial.

html div#om-mw7pzo63ch6wpfzi div#om-canvas-whiteboard-optin {
background-color:#f8f8f8;
}
html div#om-mw7pzo63ch6wpfzi h3 { 
text-align:center;
}
html div#om-mw7pzo63ch6wpfzi .tagline { 
font-style:italic;
}
html div#om-mw7pzo63ch6wpfzi .wpforms-container-full .wpforms-form .wpforms-field {
    padding: 10px 0;
    clear: both;
}
html div#om-mw7pzo63ch6wpfzi .wpforms-container-full .wpforms-form .wpforms-field-label {
    display: block;
    font-weight: 700;
    font-size: 16px;
    float: none;
    line-height: 1.3;
    margin: 0 0 4px 0;
    padding: 0;
    }

html div#om-mw7pzo63ch6wpfzi .wpforms-container-full .wpforms-form .wpforms-field-hp {
    display: none !important;
    position: absolute !important;
    left: -9000px !important;
}
    

Don’t worry if you can’t see the preview now, you can adjust your CSS later. You will be able to use your browser’s Inspect Element tool to find out which CSS classes and selectors you want to target and then add custom css by editing your optin.

Now that we are done with the design part. Let’s switch to the configuration tab in the customizer.

Change both ‘Optin Cookie Duration’ and ‘Optin Success Cookie Duration’ to 0. This will stop OptinMonster from setting duration cookie.

Optin configuration

You also need to change ‘Optin Success Message’. By default it thanks users for signing up, but we are using it on a contact form. You should change success message to thank users for contacting you.

Since our popup will only appear when a user clicks on a link or a button, this means we need to enable manual trigger. Check the box under ‘Load on Manual Trigger?’ option.

Load on manual trigger

Click on the Save button to store your optin settings, then click on the close button to exit customizer.

Step 3: Adding popup in Your WordPress Site

Switch back to your WordPress admin area and click on OptinMonster. You will see your list of optins. If you don’t see your optin, then click on refresh optins button.

Optins page on your WordPress site

Click on the ‘Edit output settings’ link below your optin. This will bring you to output settings for the popup.

Enable optin on your site

First you need to check the box next to ‘Enable optin on site’ and ‘Load optin globally’ options. If you don’t check these, then the popup will not appear on your site.

Scroll down on the page, and you will see the option ‘Parse content for shortcodes’. Make sure it is checked, otherwise OptinMonster will not parse the shortcodes inside your popup.

Enable shortcodes in popup

Next you need to enter the shortcode that you have included in your popup. This is your contact form shortcode.

Click on the save settings to store your changes.

Adding Link or Button to Trigger Contact Form Popup

First you will need your OptinMonster optin’s slug. Click on the OptinMonster icon in your WordPress sidebar. You will see the optin slug next to your optin title.

Optin slug

Create a new page in WordPress or edit a post or page where you want to add the contact form popup link or button. In the post editor switch to text editor and add your popup link like this:

<a href="#" class="manual-optin-trigger" data-optin-slug="mw7pzo63ch6wpfzi">contact us</a>

Don’t forget to replace the data-optin-slug with your own optin slug.

Save your changes and visit your post/page. Click on the link to see your contact form popup in action.

Contact Form displayed in a lightbox popup

You can use this link anywhere on your WordPress site. You can add it to post or pages, to text widgets, even in your WordPress templates.

That’s all. We hope this article helped you boost your conversion rates by using a contact form popup in WordPress. You may also want to checkout how OptinMonster helped us boost our email subscribers by 600%.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

196 Shares
Share
Tweet
Share
Pin
Popular on WPBeginner Right Now!
  • Revealed: Why Building an Email List is so Important Today (6 Reasons)

    Revealed: Why Building an Email List is so Important Today (6 Reasons)

  • Google Analytics in WordPress

    How to Install Google Analytics in WordPress for Beginners

  • How to Start Your Own Podcast (Step by Step)

    How to Start Your Own Podcast (Step by Step)

  • How to Fix the Error Establishing a Database Connection in WordPress

    How to Fix the Error Establishing a Database Connection in WordPress

About the Editorial Staff

Editorial Staff at WPBeginner is a team of WordPress experts led by Syed Balkhi. Trusted by over 1.3 million readers worldwide.

The Ultimate WordPress Toolkit

27 Comments

Leave a Reply
  1. Ankit says:
    Jun 29, 2020 at 3:44 pm

    A well written article. Must read for non-tech beginners like me.

    Reply
    • WPBeginner Support says:
      Jun 30, 2020 at 11:41 am

      Glad you found our content helpful :)

      Reply
  2. Deepak says:
    Dec 27, 2018 at 2:04 pm

    Hi i want to popup form whn i clk button… How i can do this

    Reply
    • WPBeginner Support says:
      Dec 31, 2018 at 4:16 pm

      For what it sounds like you are wanting, you would want to take a look at OptinMonster: https://www.wpbeginner.com/wordpress-plugins/optinmonster-wordpress-popup-plugin/

      Reply
  3. Isaac says:
    Oct 19, 2018 at 1:26 pm

    This is nice, but can you explain/show how to do this without OptinMonster? I don’t want to have to buy a second plugin just to show a form in a popup. This should be do-able with WP Forms and a free lightbox plugin.

    Reply
    • Editorial Staff says:
      Oct 23, 2018 at 6:54 am

      Hi Isaac, there are likely other plugins that can do this, but we recommend the solution that we’re using ourselves. We have a good tutorial on how to pick the best plugin while you look through the WordPress.org plugin directory.

      Reply
  4. Kulwant Singh says:
    May 24, 2018 at 4:54 am

    can i create differents popup for different post ? it is possible or not

    Reply
    • WPBeginner Support says:
      May 26, 2018 at 7:45 pm

      Hi Kulwant,

      Yes, you can create different popups for different posts.

      Reply
  5. Lela Donelson says:
    Nov 21, 2017 at 1:00 pm

    My WP menu does not have a WP forms option. I have a GoDaddy managed WP.

    Reply
    • WPBeginner Support says:
      Nov 22, 2017 at 2:07 pm

      Hi Lela,

      WPForms is a WordPress Plugin. You will first need to install and activate it. For more details, see our step by step guide on how to install a WordPress plugin.

      If you have already installed and activated the plugin, and you still can’t see it in your WordPress admin menu, then please contact WPForms Support or your hosting company.

      Reply
  6. Michael Wahhab says:
    Mar 23, 2016 at 7:44 am

    Where’s the demo?

    Reply
  7. Nick Vail says:
    Jan 6, 2016 at 5:59 pm

    Are pop up windows only available with the paid “business plan”?

    Reply
  8. Ruben says:
    Nov 27, 2015 at 9:38 am

    Before buying I want to ask, can I have two call-to-action buttons in a popup? I want two buttons one for downloading my app from App Store and second from Play Store.

    Reply
    • WPBeginner Support says:
      Nov 27, 2015 at 8:00 pm

      Yes you can.

      Reply
  9. shagufta says:
    Sep 2, 2015 at 6:36 am

    how to have tabs in the popup that will link to div’s which will open in the same popup

    Reply
  10. Jhorene says:
    Jul 13, 2015 at 4:07 pm

    Hello,

    Before I buy Optinmonster, can you tell me if it is fully mobile responsive to have a form inside the canvas popup?

    Thank you.

    Regards,
    Jhorene

    Reply
    • WPBeginner Support says:
      Jul 13, 2015 at 10:55 pm

      OptinMonster comes with a feature called mobile friendly popups. You can create different popups for your desktop and mobile users, providing a much better user experience to your mobile audiences.

      Reply
  11. Ian Perera says:
    May 29, 2015 at 5:53 pm

    can i pass data to gravity form

    Reply
    • Dave E says:
      Dec 10, 2015 at 7:55 am

      Hi, I’m looking for the same. Did you ever find a solution? Thanks

      Reply
  12. Alicia Beale says:
    May 15, 2015 at 3:36 am

    How can I use this pop-up contact form to notify different email addresses?

    Reply
  13. Mike Whaling says:
    May 14, 2015 at 4:03 pm

    Is there a way to do this in the new version of Optin Monster? This worked great when I was using the local WP plugin, but it doesn’t seem to recognize the Gravity shortcode now that I’ve switched over to the new OM.

    Any tips or suggestions?

    Reply
    • WPBeginner Support says:
      May 15, 2015 at 12:29 pm

      Please open a support ticket on OptinMonster website.

      Reply
  14. Silvan says:
    Apr 27, 2015 at 10:53 am

    could this work as well in a WordPress navigation? I’m having some trouble adding the data-optin-slug bit via the WP menu system.

    Reply
  15. sharul says:
    Mar 20, 2015 at 11:38 pm

    Can you please show us some demo.
    Thank you

    Reply
  16. WPBeginner Staff says:
    Nov 21, 2014 at 2:15 pm

    Please submit a support ticket on OptinMonster’s support website.

    Reply
  17. Alvin Ng says:
    Nov 21, 2014 at 11:35 am

    heya man, need some help here. No matter what i do, i can’t get optinmonster to pop up. do i need to replace the # with a link?

    Reply
  18. Don DeMaio says:
    Jul 20, 2014 at 10:47 am

    This would be great if they offered a demo to check it out.

    Reply

Leave a Reply Cancel reply

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.

Over 1,320,000+ Readers

Get fresh content from WPBeginner

Featured WordPress Plugin
RafflePress - WordPress Giveaway and Contest Plugin
RafflePress
Giveaway and Contest Plugin for WordPress. Learn More »
How to Start a Blog How to Start a Blog
I need help with ...
Starting a
Blog
WordPress
Performance
WordPress
Security
WordPress
SEO
WordPress
Errors
Building an
Online Store
Useful WordPress Guides
    • 7 Best WordPress Backup Plugins Compared (Pros and Cons)
    • How to Fix the Error Establishing a Database Connection in WordPress
    • Why You Need a CDN for your WordPress Blog? [Infographic]
    • 30 Legit Ways to Make Money Online Blogging with WordPress
    • Self Hosted WordPress.org vs. Free WordPress.com [Infograph]
    • Free Recording: WordPress Workshop for Beginners
    • 24 Must Have WordPress Plugins for Business Websites
    • How to Properly Move Your Blog from WordPress.com to WordPress.org
    • 5 Best Contact Form Plugins for WordPress Compared
    • Which is the Best WordPress Popup Plugin? (Comparison)
    • Best WooCommerce Hosting in 2020 (Comparison)
    • How to Fix the Internal Server Error in WordPress
    • How to Install WordPress - Complete WordPress Installation Tutorial
    • Why You Should Start Building an Email List Right Away
    • How to Properly Move WordPress to a New Domain Without Losing SEO
    • How to Choose the Best WordPress Hosting for Your Website
    • How to Choose the Best Blogging Platform (Comparison)
    • WordPress Tutorials - 200+ Step by Step WordPress Tutorials
    • 5 Best WordPress Ecommerce Plugins Compared
    • 5 Best WordPress Membership Plugins (Compared)
    • 7 Best Email Marketing Services for Small Business (2020)
    • How to Choose the Best Domain Registrar (Compared)
    • The Truth About Shared WordPress Web Hosting
    • When Do You Really Need Managed WordPress Hosting?
    • 5 Best Drag and Drop WordPress Page Builders Compared
    • How to Switch from Blogger to WordPress without Losing Google Rankings
    • How to Properly Switch From Wix to WordPress (Step by Step)
    • How to Properly Move from Weebly to WordPress (Step by Step)
    • Do You Really Need a VPS? Best WordPress VPS Hosting Compared
    • How to Properly Move from Squarespace to WordPress
    • How to Register a Domain Name (+ tip to get it for FREE)
    • HostGator Review - An Honest Look at Speed & Uptime (2020)
    • SiteGround Reviews from 4196 Users & Our Experts (2020)
    • Bluehost Review from Real Users + Performance Stats (2020)
    • How Much Does It Really Cost to Build a WordPress Website?
    • How to Create an Email Newsletter the RIGHT WAY (Step by Step)
    • Free Business Name Generator (A.I Powered)
    • How to Create a Free Business Email Address in 5 Minutes (Step by Step)
    • How to Install Google Analytics in WordPress for Beginners
    • How to Move WordPress to a New Host or Server With No Downtime
    • Why is WordPress Free? What are the Costs? What is the Catch?
    • How to Make a Website in 2020 – Step by Step Guide
Deals & Coupons (view all)
Churnly Coupon
Get 30% OFF on Churnly WordPress automated churn-busting plugin.
AccessPress Themes
AccessPress Themes Coupon
Get 15% off on AccessPress Themes collection of premium WordPress themes and plugins.
Featured In
About WPBeginner®

WPBeginner is a free WordPress resource site for Beginners. WPBeginner was founded in July 2009 by Syed Balkhi. The main goal of this site is to provide quality tips, tricks, hacks, and other WordPress resources that allows WordPress beginners to improve their site(s).
Join our team: We are Hiring!

Site Links
  • About Us
  • Contact Us
  • FTC Disclosure
  • Privacy Policy
  • Terms of Service
  • Free Blog Setup
  • Free Business Tools
Our Sites
  • OptinMonster
  • MonsterInsights
  • WPForms
  • SeedProd
  • Nameboy
  • RafflePress
  • Smash Balloon

Copyright © 2009 - 2021 WPBeginner LLC. All Rights Reserved. WPBeginner® is a registered trademark.

Managed by Awesome Motive | WordPress hosting by SiteGround | WordPress CDN by MaxCDN | WordPress Security by Sucuri.