Adding Forms to Your Website

Before you add a form to your website, you should ensure it is published first.

There are various ways to add a form to your website.

Gutenberg Block

To add a form to a post or page using the Gutenberg block:

  1. Click the ‘Add Block’ icon.
  2. Search for ‘WS Form’.
  3. Click the ‘WS Form’ icon.
  4. Select the published form you wish to insert into your content.

Select the form you want to use for that block in the settings toolbar and then click the editor’s ‘Update’ button.

Visual Builders

WS Form has modules for the following popular visual builders:

Classic Editor

To add a form to a post or page using the regular WordPress visual editor (Classic Editor):

  1. Click the ‘Add WS Form’ button.
  2. Select the published form you wish to insert into your content.
  3. Click the ‘Insert WS Form’ button.

This will automatically insert a shortcode into your content.

Widget

If your theme allows widgets to be added to areas of your website, you can add the WS Form widget.

For more information about adding a widget to your website theme, click here.

Shortcode

The format of the WS Form shortcode is very simple:

[ws_form id="123"]

… where ‘123’ is equal to your form ID.

The shortcode also has an option element_id parameter which enables you to set the ID of the form element. For example:

[ws_form id="123" element_id="my-form"]

This is useful if you want to target your form using JavaScript.

PHP Code

To add a form in your PHP code, you can use the following code:

<?php do_shortcode('[ws_form id="123"]'); ?>

… where ‘123’ is equal to your form ID.