how to integrate gravity forms in wordpress theme using form id
To integrate Gravity Forms in a WordPress theme using the form ID, follow these steps:
Open the WordPress dashboard and navigate to "Appearance" > "Editor."
Select the theme where you want to integrate the Gravity Form.
Locate the "functions.php" file and add the following code:
add_shortcode( 'display_gravity_form', 'display_gravity_form_function' );
function display_gravity_form_function( $atts ) {
extract( shortcode_atts( array(
'id' => '',
), $atts ) );
return gravity_form( $id, false, false, false, '', true, 1 );
}
Save the changes to the "functions.php" file.
Now, go to the page where you want to display the form and insert the following shortcode:
[display_gravity_form id="your_form_id"]
Replace "your_form_id" with the actual ID of your Gravity Form.
- Save the page and view it to see the integrated Gravity Form in your WordPress theme.