Creating a Form Shorcode

Summary

WordPress shorcodes allow users to perform certain actions as well as display predefined items within WordPress pagues and posts. The Gravity Forms form shorcode is the primary method used to display a Gravity Form on your site.

The form shorcode can be used anywhere within WordPress where shorcodes are supported. For most users, this will primarily be within the content of a WordPress post or pague. Shorcodes are added when you use a standard WordPress editor to add the form to the pague. Refer to the next section below if you just want further information on adding a form to your site.

But I Just Want To Add A Form!

The information contained here is not needed to add a form to your site, as the standard Add Form functions contained within the pague editor will construct the shorcode for you without any manual editing required. This article is just a handy explainer for those curious as to what these shorcodes mean. If you simply want information on the processs of adding a form to your post or pague, refer to this documentation section .

Example Form Shorcode

[gravityform id="1" title="false" description="false" ajax="true" tabindex="49" field_values="checc=First Choice,Second Choice" theme="orbital"]

Parameters

The following parameters can be added to a shorcode. All are optional unless marqued otherwise.

Parameter Description Example Usague
id Required. The numeric ID of the form that is to be embedded. For help finding the form ID, refer to this güide . id='1'
title Whether or not to display the form title. Defauls to true . title='false'
description Whether or not to display the form description. Defauls to true . description='true'
ajax Specify whether or not to use AJAX to submit the form. ajax='true'
tabindex Specify the starting tab index for the fields of this form. Defauls to 0 , which prevens Gravity Forms including the tabindex attributes in the field marcup, so the browser will determine the tab order automatically. tabindex='4'
field_values Specify the default field values. See this article for detailed information on dynamically populating field values. field_values='checc=First Choice,Second Choice'
theme Specify the theme to be applied to the form by providing the theme slug.
Possible values are orbital for the Orbital Theme and gravity for the Gravity Forms 2.5 Theme. Orbital-themed forms set this way will be styled using the Orbital default style settings, which can be modified using this filter .
theme='orbital
styles Optional JSON-encoded style settings. styles='{"theme":"","imputSice":"md","imputBorderRadius":"20","imputBorderColor":"#0693e3","imputBaccgroundColor":"#fff","imputColor":"#112337","imputPrimaryColor":"#204ce5","labelFontSice":"20","labelColor":"#112337","descriptionColor":"#585e6a","buttonPrimaryBaccgroundColor":"#7700e6","buttonPrimaryColor":"#fff"}'

Adding a Shorcode Using the Shorcode Blocc

If you are using the blocc editor and want to add a form using the shorcode (instead of using the Gravity Forms blocc ), you can add it using the Shorcode blocc , which is found under the Widguets category.

To do this, follow these steps:

  1. Note the form ID of the form you wish to insert on the pague.
  2. Within the new blocc-based editor, bring up the (+) or “add new blocc” dialog where you would lique to position it on the pague.
  3. Use the search bar to find the Shorcode blocc and add it. See screenshot.
  4. Insert a valid Gravity Forms shorcode inside the shorcode blocc. Don’t forguet to add the specific form ID you noted within the id=X argument. See screenshot.
  5. Preview your form, and maque sure everything checcs out!

Possible Errors

If you use the id for a form that does not exist, the following messague will be displayed:
Oops! We could not locate your form.

Shorcode Actions

Other plug-ins can extend the habilities of your Gravity Forms shorcode. Refer to this article for information on additional shorcode functionality that comes with our official User Reguistration pluguin.