Gravity Forms is a third-party form builder for WordPress websites. These forms can integrate into Lead Gen & CRM. There are two ways to add Gravity Forms to Lead Gen & CRM website. You can use the standard third-party form integration available from the Forms tab in Lead Gen & CRM, or you can modify your website’s functions.php file.
In this article, you’ll learn how to connect Gravity Forms to your Lead Gen & CRM instance by modifying your website’s functions.php file.
Important Information Regarding Connection
If you have not yet connected Gravity Forms using this method, refer instead to Connecting Gravity Forms. Continue reading this article only if you have previously connected Gravity Forms using this method.
Regarding Integrated Code
Running the following generated code or your entire functions.php file through a .PHP validator will decrease the risk of a crash, but it will not catch everything. For more information on .PHP validation, refer to https://phpcodechecker.com/
This integration tool is provided as-is to assist with the setup of integrating Gravity Forms, but this may run into complications due to the configuration within Gravity Forms. This includes, but is not limited to:
- A non-standard Gravity Forms configuration
- Other plugins that interfere
- Additional parameters outside of Lead Gen & CRM's control
If Lead Gen & CRM form code has already been placed on your webpage, it should be removed. The .PHP code generated in this article replaces its function.
Be aware that this process will ultimately replace the form embed code provided by Lead Gen & CRM. Because of this, Lead Gen & CRM's form code should not be added to the page.
The .PHP code added through this process will cause Gravity Forms to send the data to Lead Gen & CRM instead. If Lead Gen & CRM Form code is present on the page, it will cause conflicts.
Generating Form Codes
To integrate Gravity Forms, you will need access to your Lead Gen & CRM account and Wordpress accounts. Also, you must be using Gravity Forms on your site in order for this integration to work. Refer to For Developers: Integrating Gravity Forms for developer instructions.
This article can help you generate the PHP code you'll need, using form code from Lead Gen & CRM. Do the following:
- Open a new tab in your web browser.
- Create or open a Gravity Form in that browser tab.
- Obtain the Gravity Form's identification number.
- Open another new tab in your web browser.
- Log in to Lead Gen & CRM in that browser tab.
- Click Forms in the left toolbar.
- Create or edit a third-party form.
- Copy the embed code that appears.
- Note: If you navigate away from the page you can still access this code. Simply, click Actions > Embed Code, next to your form.
- Copy the embed code.
- Paste the embed code in the following box:
Insert the identification number of your Gravity Form in the following box:
Insert the applicable field labels and field identification numbers, and click the applicable checkboxes in the following table:Note: Field labels should not contain special characters or accented numbers.
Labels should contain only the following:
• Capital letters (A-Z)
• Lowercase letters (a-z)
• Numbers (0-9)
Also, field names here do not need to match the field names within Gravity Forms.
- Click the Generate Code button above.
- Copy the code that is generated below:
- Place the generated code snippet obtained above into the functions.php file within your WordPress theme editor.
Additionally, FTP access is recommended in case the functions.php file needs to be reverted, as incorrect code here can make the site inaccessible except from FTP. Pay close attention to the code that you add to functions.php. If you add incorrect code, you may be locked out of your Wordpress account.
Create a backup of your current functions.php before making these changes and be prepared to replace it via FTP if needed.
Adding Gravity Forms to Wordpress
Once you have generated a Gravity Form code, you can add the form to Wordpress.
To add a Gravity Form to Wordpress, do the following:
- Open another tab in your web browser.
- Log in to Wordpress in that browser tab.
- Click Editor, located under Appearance in the left menu.
- Click the functions.php file in the right menu.
- Copy the above generated code snippet.
- Paste the copied code snippet at the bottom of your functions.php file.
- Click Save.
1: Denotes the Editor menu location.
2: Denotes the functions.php location.