How to add Gravity Forms

how-to add gravity forms outside gui

Gravity forms are pretty simple to embed on your website; you can easily add forms to widgets and content. But what happens when you need to add a form to a section outside of the GUI (graphical user interface)?

gravity forms block

How to add Gravity Forms outside of WordPress’s GUI

  1. Find where you’d like to add Gravity Forms

    gravity forms

    You will need to figure out which corresponding file you need to add the script to (e.g., blog posts = single.php)

  2. Open the file using an FTP manager

    ftp manager

    It’s best to do edits on a staging server in case you break the site. If the site is new and has zero traffic, I wouldn’t worry about a staging server.

  3. Add the Shortcode Script

    single-php

    You have two options for this:

    <?php gravity_form( 1, false, false, false, '', false ); ?>

    This snippet will display the form with an id of ‘1’; the title and description will not be displayed, the form itself will not display if it is inactive, and it will not use AJAX for form submission.

    <?php echo do_shortcode('[gravityf0rm id=1 name=ContactUs title=false description=false]'); ?>

    Do_shortcode adds a wrapper around a classic shortcode embed code and allows it to be executed within a PHP environment. You can add any traditional embed code in its place.

* I’ve added a 0 to gravity forms do_shortcode above so it would not render a form in my how-to guide

Leave a Reply

Your email address will not be published. Required fields are marked *