How to use Gravity forms Shortcodes to Embed a Form

Gravity forms is one of the leading form processing and management plugin for wordpress powered blogs. You can easily install gravity forms in your blog but the tricky thing is to display the forms in your post because you have to know some basic knowledge in shortcodes, so if you find difficult in integrating gravity forms this little post will help you to finish things easily.

Before entering into this topic let me clear about what are shortcodes? Shortcodes is very common in modern day web designing, it is nothing but a small call word to pull down the content or a specific functionality to particular place, for example if you want gravity forms to be added in a specific page just a small gravity form shortcode “gravityform” is enough to create a new form.

Here in this article I’m going to discuss about the basic gravity forms shortcodes, it’s structure and its basic functions and explanations.

General Gravity Forms Shortcodes

[gravityform id=# name=TEXT title=boolean description=boolean ajax=boolean]


This is the general shortcode form for integrating gravity forms and check out the detailed explanation for the parameters used in the shortcodes.

Id (required) – The specific id of any form or function, you can get it on ID column of gravity forms edit forms page.
Name – Name or title of the form.
Description – It will display the form description to the users about what the forms is all about.
Ajax – Submit the form without refreshing the screen.

Conditional Shortcode

This allows you to perform conditional logic in the message content of your Admin and User Notification emails. It consists of an opening and closing shortcode so any text or content within the opening and closing conditional shortcode will be treated as conditional shortcode.

[gravityforms action="conditional" merge_tag="{Number:1}" condition="greater_than" value="3"]Content you would like to conditionally display. [/gravityforms]

Action – The action you like to perform in the form, as by default it is always set to conditional.
Merge_tag – Get the correct merge tag for the form data by using the insert merge tag drop down.
Value – The condition must be equal in order for the condition and the content be displayed.

Embed via Functional Calls

In this chapter I’ll show you how to implement the gravity forms shortcodes in applying changes or creating a form in wordpress. If you need to place a form in wordpress using gravity forms you must place this following code to embed a simple form,

<?php gravity_form($id, $display_title=true, $display_description=true, $display_inactive=false, $field_values=null, $ajax=false, $tabindex); ?>


$display_description is set to true so it will display the description of the form.
$display_inactive is set to Boolean false so it will not display form even it is inactive.
$field_values – It will pass an array of dynamic parameters key with its corresponding values to get populated.
$ajax is used to set AJAX for form submission to refresh the page or not, by default it is set to false.
$tabindex is used to start a tab index for the field of the form.
$form_id is used to target forms using specific id.
Enough of knowing the terms and parameters now we can discuss about how to embed a form using basic functional call.

<? php gravity_form(1, false, false, false, ”, false);


These readymade small snippets will display the form with the id of “1” and with no title and description and it will not use Ajax for form submission.

<? php gravity_form(1, false, false, false, ”, true, 12); ?>

These snippets will do exactly what the previous snippets will do but the present one will use Ajax for form submission as it is set to “true” and the starting tab index is 12.
Hope you got some ideas about shortcodes and how to use it to embed gravity forms in your wordpress blogs. If you still feel difficult in gravity forms integration, and need any help regarding any gravity form shortcode, please lets us know in comments, I’ll help you to fix the issues.

Written by Ron Davis. Edited by Aritra Roy.

This is a guest post by Ron Davis. A freelance blogger and a passionate social media marketer, who is currently working on the site Gravity forms discount where you can buy gravity forms at 40% off and get detail information about gravity forms addons.

3 Responses to “How to use Gravity forms Shortcodes to Embed a Form”
  1. Tushar Roy says:

    Useful information. Nice post.
    Tushar Roy recently posted..Getting a E-mail notification when someone visit your siteMy Profile

  2. Doug Smith says:

    Ron:
    Great article. I am trying to use GF on an image that is in the Nav Bar using a Fancybox. Here is the code in my functions.php to call the form in a Fancybox:
    add_filter (‘wp_nav_menu_menu_items’,'add_contactus’, 10, 2);
    function add_contactus($items, $args) {
    $items .= ‘ ‘;
    return $items;
    }
    The site URL is: http://74.54.88.165/~hawk77/
    When I click on the orange Email Page button, the Fancybox tries to open but the form isn’t displayed.
    I have used the same Fancybox to display the form, you can see it on the Testimonials tab and click on it and see that it works. Any ideas why I can’t get the form to display from a in the Nav bar? Thanks for your time and keep up the good work.
    Doug

Leave a Reply

CommentLuv badge
This blog uses premium CommentLuv which allows you to put your keywords with your name if you have had 5 approved comments. Use your real name and then @ your keywords (maximum of 1)