Popup wordpress feedback form. How to create a wordpress popup feedback form

Hello. In this lesson, we will do a full-fledged feedback form, and it will appear in a modal window by clicking on the button on the page. I did this lesson myself, from scratch, using only the jQuery framework and one small JavaScript "ohm. The lesson is very interesting, so please do not pass by! Below you can watch a demonstration of the form I got and also download the necessary files for work:

Step 1.  General description and operation of the feedback form:

First, I will tell you which files we will need and, in fact, why they are needed:

  • images  - a folder where all the images of our form are stored;
  • index.html  - the main, "index" file, in which the button will be located to call the feedback form;
  • contact.html  - the file in which the form itself is located. This file will be connected to the modal window;
  • send.php  - file handler involved in sending letters;
  • jquery.js  - The main jQuery framework;
  • style.css  - file with cascading style sheets for our form.

So, let's move on and in order ... The form will work as follows: The user goes to the page on which the button for calling the modal window is located, clicks it, then the form appears, in it the visitor enters all the data and the message text and sends, then he is thrown to the page with a message about the successful or unsuccessful sending of the letter. That’s all, and now we’ll begin to layout our form ...

Step 2  Button to call the form.

So that our modal window with the form appears, you need to somehow force it to do this. To do this, we just need to place an ordinary button on the page. The code for this button is shown below, along with the styles applied to it:

Step 3  The form itself + settings for it

Now let's figure out where our feedback form will still be located. And it will be in the file contact.html, which is already located in the source code of the lesson. This form is very small, so I’ll place its code below:

Sending Administration Message:



*Name:
* Email:
Theme:
*Message:

As you can observe, walking along the code even with the naked eye, it can be seen that for a better display of the form I used a table layout. This was very useful to me to compare all the fields of the form.

Step 4  Handler responsible for sending emails

Here I will quickly tell you about the main handler for sending letters. I will not give his code here, because it is in the source. Download and see its contents. If you know php somewhere at an average level, something like me, then you can easily parse all the code for this handler yourself. If everything is ready, then move on ...

Step 5  "Twisting" the main jQuery framework

Now, as in any jQuery tutorial, we need to screw the main jQuery framework. To do this, let's go back a little to where our button is located, and between the tags   and  insert the following code:

Step 6  Shape styling

As you can see, the styles for our form are taken out separately, to a file style.cssbecause these styles take up too much space. We just need to bind the code below to our index file:

Step 7  jQuery improvements

Now for the modal form window to work properly, we need to insert the following jQuery code:

Conclusion

So our interesting feedback form is ready. The path was long and difficult, so if someone did not understand something, I will listen to your questions in the comments to this lesson. And that's all for me, until we meet again, friends!

Sincerely, Your jQuery Explorer - M.K.

Greetings, dear reader, in this article I will show you how to create a feedback form in a pop-up window on your WordPress site. Often when developing your own website or blog, you need to establish the possibility of operational communication with visitors to the Internet resource. In this case, the pop-up feedback form for wordpress will come in handy, which will help to establish quick contact with users.

Why do I need a pop-up feedback form for wordpress

Reasons for use

Consider why this form is needed

  1. Saving free space on the site. The contact form can be placed anywhere: in the footer or header, in the main content of the page, in the form of a floating button, etc.
  2. Effective appearance. Animation of a new window appears interesting and unusual
  3. Availability. You can leave entries in this form from anywhere on the site, users do not need to return to the main page.

Additional bonus: the form is easy to modify and customize to the needs of your site. The pop-up feedback form for wordpress can be presented in the form of an opening window for ordering a call, service or product, subscribing. If desired, you can add visual effects, various images, etc.

Popup plugins

Consider the tools necessary for developing pop-ups in wordpress - a special application for developing and creating websites.

Contact Form 7

This plugin is used directly for constructing a form. To install it, follow these steps:

Easy fancybox

This plugin is suitable for developing a pop-up window effect. The installation sequence for Easy FancyBox is similar to installing the previous plugin.

Plugin settings

You can configure Easy FancyBox add-on settings through media files. Use the options menu "Settings" -\u003e "Media".

In the block that opens, just below the standard settings, the parameters of the plug-in will be located. Here usually there is a checkmark opposite the “Images” item, which indicates the activation of the pop-up window when you click on the image. It is advisable to remove it, since if there are other additional tools for creating pop-up animations, the images will double open.

But that is not all. Check the box next to “Inline content”

Everyone can additionally delve into the settings of the plugin and set them to their discretion.

Tip: if you want the form to always be open, then uncheck the “Close FancyBox when overlay is clicked” option in the Easy FancyBox settings, which performs the function of closing the window when the mouse is clicked outside.

Step-by-step instruction

Well, the “boring” preliminary preparation is over, now let's move on to the most “tasty” part - how, in fact, the wordpress pop-up feedback form is developed.

Form Window Processing

Where do we start? Of course, with pre-setting the form itself. Select “Contact Form 7” from the right menu, and then select the “Add new” option.

Create a new name for the form, for example, “Experiment”, drive it into the input field of the window that opens, where the text “Title” is located, and click on the “Save” button. You can change other parameters, including the form template itself, but we will not touch it. Now our main goal is simply to learn how to create pop-up forms.

Take a look at the result. As you can see, the plugin generated a special shortcode used for subsequent output of the form. You need to copy it.

Form Derivation

Now let's do the programming. The new program code can be inserted anywhere on the site, for example, in Contacts, and others. In our example, the new form will be displayed in the widget. Select "Appearance" in the menu, then click on "Widgets", then in the window that opens, click on the "Text" option.

Now click on the “Add widget” button

Paste the following code into the Content entry field:

  Write a letter

This is what the result will look like:

Keep in mind that instead of the shortcode specified in the example, you will need to specify the one that was formed as a result of creating a new form.

Additionally, the form can be edited: add or remove input fields, enter the start and / or end text before and after the form, convert the text to a heading or display it in a separate block, use various styles, placeholders, etc. There would be time and desire!

Link styling

We also consider two ways to convert a link into a button to improve its visual display.

1 way - using additional theme styles.

The program code below can be inserted as follows:


The program code itself looks like this:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24   / *** Button link display **** / .contact-us a (margin: auto; / * alignment of the block in the center * / display: block; width: 199px; / * button size * / padding: 11px 22px ; / * inner indentation * / border: 1px solid black; / * hue of the frame * / background: # 3399ff; / * background pattern * / text-decoration: none; / * conversion of the text to the unmarked * / text-align: center; / * label centering * / color: #ffffff; / * label hue * / -moz-transition: all 0.6s ease; -webkit-transition: all 0.6s ease; transition: all 0.6s ease;) / ** Change the color links when hovering ** / .contact-us a: hover (-moz-box-shadow: 0 0 7px # 111; -webkit-box-shadow: 0 0 7px # 111; box-shadow: 0 0 7px # 111 ; -moz-transition: all 0.6s ease; -webkit-transition: all 0.6s ease; transition: all 0.6s ease;)

/ *** Button link display **** / .contact-us a (margin: auto; / * alignment of the block in the center * / display: block; width: 199px; / * button size * / padding: 11px 22px ; / * inner indentation * / border: 1px solid black; / * hue of the frame * / background: # 3399ff; / * background pattern * / text-decoration: none; / * conversion of the text to the unmarked * / text-align: center; / * label centering * / color: #ffffff; / * label hue * / -moz-transition: all 0.6s ease; -webkit-transition: all 0.6s ease; transition: all 0.6s ease;) / ** Change the color links when hovering ** / .contact-us a: hover (-moz-box-shadow: 0 0 7px # 111; -webkit-box-shadow: 0 0 7px # 111; box-shadow: 0 0 7px # 111 ; -moz-transition: all 0.6s ease; -webkit-transition: all 0.6s ease; transition: all 0.6s ease;)

This button turned out:

The code already says what its parameter is responsible for. Now everyone can edit the code at their discretion, experimenting with different styles and colors and creating the most suitable link for the pop-up window.

2 way - using the image in the form of a button. First upload the necessary image to the site (any one to your taste, not necessarily in the form of a button - this does not really matter). To do this, click on "Media" -\u003e "Add new" and select the desired picture. A permalink to the file will appear to the right of the image (in this example http://www.sait.ru/wp-content/uploads/2017/04/depositphotos_2169498-E-mail-internet-icon.jpg), copy it and add to code (do not remove quotes):

Add the resulting code to the main code of the form output instead of the text “Write a letter”.

1

A button appeared on my site, shown in the screenshot below:

And this is how the button will look if you leave the additional style described in the first method:

Adding to the menu

So that the pop-up feedback form for wordpress can be called directly from the menu, you must use the following code

1 2 3
  •   Write a letter
  •   Write a letter
  • First you need to figure out exactly where to insert this code. Go to the "Editor" through the "Appearance" and among the templates select "Header (header.php)"

    Now find the place where the menu code is located. Find the following information:

    1 2

    Do you like the article? Share with friends: