[give_form] shortcode allows you to insert a donation form anywhere on your website. Give also includes a shortcode builder which will make this process even easier.
Each Give donation form you create has a unique ID which the
[give_form] uses to select the appropriate content to insert. If the ID field is missing nothing will output (or you will see an error message if you have debug turned on).
The "id" is a required attribute for this shortcode. The "id" should be the post ID of a published donation form.
Using the Shortcode Builder
Using the shortcode builder is the easiest way to embed a donation form on a page or post. To begin using the Give shortcode builder first navigate to the page or post you wish to insert the shortcode into.
You will see the following button above the main editor:
Once you’ve chosen your form from the list, you have several options to customize the display of this form on your page.
Note that each of these settings is optional. If you do not choose any of them, the defaults will be used instead.
- Show Title — optionally show/hide the form title. Default is “true” which means the title will show by default.
- Show Goal — optionally show/hide the form goal, if applicable. Default is “true” for forms with a goal, and this parameter will have no effect on forms without a goal.
- Display Content — optionally show/hide the form content. You can choose from None, Below, or Above. This will override the default settings of the form. The Default value is whatever you chose when you created the form.
- Display Options — this is the Display mode setting. Optionally override the setting you set when you created the form. You can choose from “All Fields” to display all fields on the page when it loads, “Modal” to display fields in a modal button that shows only the title and total before clicking the button, “Reveal” which shows all fields on the page after a click, or “Button only”which puts all fields within the modal, and only has the “Donate Now” button visible.
Once those are all set, click “Insert Shortcode” and you’ll see your shortcode inserted into the editor directly.
Copy and Paste Method
You may have noticed when you update or publish a donation form that there’s a “Give Form Shortcode” field within the “Publish” metabox:
This is to provide you an easy copy-and-paste method for inserting the shortcode across your site. Simply copy-and-paste this shortcode within the appropriate page, post, widget, or code as necessary. Also noteworthy is that the shortcodes also appear within the form listing screen in their own column:
The only required parameter in the shortcode is the form ID, which is included in the copy/paste instructions above. The following optional parameters can be added to the shortcode:
- show_title: This allows you to display the form with or without the Title. The default is “true,” meaning that it will show the title unless you set this value to “false” within the shortcode, like this
[give_form id="43" show_title="false"]
- show_goal: This allows you to display the form with or without the goal. The default is “true,” for forms with a Goal enabled meaning that it will show the Goal unless you set this value to “false” within the shortcode, like this
[give_form id="43" show_goal="false"]but if the form does not have a goal, this parameter is disabled and will not affect the output.
- show_content: This allows you to display the form with or without the content. The default is whatever is set in the form’s settings for forms with content enabled meaning that it will show the content unless you set this value to “none” within the shortcode, like this
[give_form id="43" show_content="none"]. To override the settings via shortcode, your options are
none. If the form does not have content, this parameter is disabled and will not affect the output.
- display_style: This allows you to override the method of displaying the form’s payment/additional fields. If you do not declare a parameter here, it will default to the option selected in the form’s display settings. The options are
onpageto display all the fields on the page
modalto display as a modal
revealto display the fields on the page after a click
button(new in Give 1.8) to display only a button with no additional fields
For reference, this is a properly formatted shortcode to display a button:
[give_form id="43" display_style="button"] Also note that the
reveal options enable a new parameter:
- continue_button_title: This enables the modal, button, and reveal button’s text to be customized, per shortcode. If not declared, it will default to the text set in the form’s display options and if that text is not customized, will default to “Donate Now.” This is how to configure a reveal shortcode with the text “Continue” as the continue button:
[give_form id="43" display_style="reveal" continue_button_text="Continue"]