If you work with Gravity Forms and build your WordPress themes on Bootstrap, you may find the following function quite useful.

Gravity Forms Filter

Read more about the gform_field_content filter.

add_filter("gform_field_content", "bootstrap_styles_for_gravityforms_fields", 10, 5);

Custom Functions to Add Bootstrap Classes

The following functions use str_replace() which was chosen for this task because it effectively modifies only the small bit of the string we need it to. Gravity Forms [aff] has a reliable structure, so we just insert class names as needed for our common form field types.

View on Github

Example form for Bootstrap 4

  • :
  • Column 1Column 2Column 3 
    Add a new row

Related Topics

Bootstrap | Github