Gravity Forms Data Attributes
Add custom data attributes to your Gravity Forms field markup
by Matt Mirus · github.com/mmirus/gravity-forms-data-attributes · website
★ 16stars
1.6kcomposer installs
2forks
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/mmirus/gravity-forms-data-attributes/archive/refs/heads/master.zipAlso on Packagist as mmirus/gravity-forms-data-attributes:
composer require mmirus/gravity-forms-data-attributesDeclares an update source (https://github.com/mmirus/gravity-forms-data-attributes), so updates arrive through the plugin's own updater.
From the readme
Gravity Forms Data Attributes
- Usage
- Installation
- Contributing
- Screenshots
This plugin allows you to add custom data attributes to Gravity Forms fields.
It should work with:
- all of the Standard field types
- any of the Advanced field types that only have one input field (e.g., Email but not Address)
- the List advanced field type, including with multiple columns (thanks @reddo!).
For fields with choices, such as checkboxes, you can assign separate values for each data attribute for each choice (the UI for this is ugly right now 🤷).
Usage
For each field you want to enable data attributes for:
1. On the field's General settings tab, check the Enable Data Attributes box.
2. In the Data Attribute Names field that appears, enter one data attribute name (e.g., my-attribute) per line.
- Do not prefix your attribute name with data-. The plugin will do that for you,
3. Save your form.
4. Reopen the field settings. You will now see additional setting fields where you can enter the value of each data attribute you added.
- For fields with choices, such as checkboxes, the data attribute value settings appear next to each choice's name and value fields.
- For other fi
Read the full README on GitHub →