This post is about Gravity Forms, a WordPress contact form plugin.
I know about Gravity Forms…but what are shortcodes?
Think of shortcodes as a placeholder for where other content will be displayed: instead of “Insert a Gravity Forms form here,” we use the `gravityform` shortcode. Learn more about shortcodes on WordPress.org.
The Gravity Forms `shortcode` has five pieces:
- `id` (required) – The ID of the form, as displayed on the Gravity Forms Edit Forms page in the Id column
- `name` (required) – The name of the form.
- `title` – Show the title to users? Default is true; set to “false” to disable
- `description` – Show the form’s description to users? Default is true; set to “false” to disable.
- `ajax` – Submit the form without refreshing? Default is false; set to “true” to enable.
Gravity Forms Shortcode Examples:
Will result in Form #1 being displayed without a title or description, with no-refresh entry submission.
The shortcode above could be read as: “Insert Gravity Forms Form #1 here. Do not show the title or description. The form should use Ajax to submit entries.”
Will result in Form #2 being displayed. The title and description will be displayed (they are true by default), and entries will require a page-load (ajax is off by default).
Will result in Form #3 being displayed. The title will be displayed, but the description will not. Entries will not require a page-load (ajax is turned on).
This post has been created to make explicitly clear how the Gravity Forms shortcode works. If you have any unanswered questions, please leave them in the comments below and they will be answered.
An (advanced) note about custom Gravity Forms shortcode attributes:
In Version 1.6.5 of Gravity Forms, a feature was added to allow for custom shortcode attributes to be added by other Gravity Forms add-on plugins. This means that there may be more pieces to the shortcode in the future!