August 31, 2023: Added support for using specific inputs in the
:filter
modifier.May 2, 2023: Added support for parsing modifiers that include underscores (e.g.
:my_custom_modifier
).February 9, 2022: Fixed issue where Signature field images would not show if using the
:filter
modifier and GF Signature 4.0 or newer.January 19, 2022: Added support for excluding Consent field descriptions using the
:exclude
modifier.November 3, 2021: Added support for excluding specific child fields from a Nested Form field via the
:exclude
modifier.October 1, 2021: Added the
gwaft_template_paths
filter to allow filtering the available template paths including adding a custom path.June 16, 2021: Fixed an issue where
nopricingfields
may still show "Order Summary" label when other modifiers are used.June 14, 2021: Fixed an issue where "Order Summary" label would still appear when using
nopricingfields
modifier.April 16, 2021: Added support for filtering via custom function.
November 9, 2020: Added support for excluding specific inputs of multi-input fields via the
:exclude
modifier.November 3, 2020: Migrated snippet to the Snippet Library.
January 27, 2020: Added
:nopricingfields
modifier to hide pricing fields from{all_fields}
output.September 5, 2019: Fixed notices generated in PHP7.3 by
continue
statements inside a foreach/switch.April 11, 2019: Updated priority of template replacement to avoid conflict with other merge tags replacement plugins.
The Gravity Forms {all_fields}
merge tag provides a super simple way to output all of the submitted form data but it’s notoriously difficult to customize.
This simple Gravity Forms plugin provides templating support for the {all_fields}
merge tag. Huh? It means you can replace the markup generated by the merge tag with the contents of a file. This tutorial offers a solid starter template file too!
Getting Started
This tutorial assumes you’re running a recent version of Gravity Forms, that you already have the {all_fields}
merge tag implemented wherever you want, and that you ♥ Gravity Wiz.
![]() |
Download, install, and activate the plugin. |
![]() |
Download the sample template directory/file. Add the folder to your active theme’s root directory: /wp-content/themes/{your-theme}/
|
![]() |
Customize the template as desired. |
Template and Merge Tag Options
This plugin provides a few handy modifiers for controlling which template will be used to render the {all_fields}
merge tag.
Note: All template paths are relative to your theme’s root directory.
Default Templates
Merge Tag | Template |
---|---|
{all_fields} | /gravity-forms/all-fields.php |
Form-specific Template
Providing a form-specific template requires no changes to the merge tag. Simply append the targeted form ID to your template’s name. This template will now only be used when the merge tag is used in the context of the specified form.
Merge Tag | Template |
---|---|
{all_fields} | /gravity-forms/all-fields.php /gravity-forms/all-fields-1.php |
Custom Template
You may want to create a custom template that should only be applied to specific instances of the merge tag. The “template” modifier allows you to specify a custom template suffix.
Merge Tag | Template |
---|---|
{all_fields:template[custom]} | /gravity-forms/all-fields-{template}.php /gravity-forms/all-fields-custom.php |
No Template
You may want to create a generic template that applies to all instances of the merge tag by default and then disable that template to use the default Gravity Forms merge tag output in a few specific instances.
Merge Tag | Template |
---|---|
{all_fields:notemplate} | No template |
Hide Pricing Fields
Hide pricing fields (i.e. order summary) from the {all_fields}
output.
Merge Tag | Template |
---|---|
{all_fields:nopricingfields} | Hide pricing fields |
Field Filtering Modifier
These modifiers allow you to control which fields are output in the {all_fields}
merge tag without having to touch any code.
Please note: you only need the plugin installed to use these modifiers. You do not need to install the template files in your theme.
Merge Tag | Description |
---|---|
{all_fields:include[1,2]} | Include a field that is not included by default (i.e. HTML fields). |
{all_fields:exclude[3,4]} | Exclude a field that is included by default. |
{all_fields:filter[1,2]} | Only include the specified field IDs. This takes precedence over both the ‘include’ and ‘exclude’ modifiers. |
{all_fields:include[1,2],exclude[3]} | The :include and :exclude modifiers can be combined. |
GF Nested Forms Support
To filter which fields from a child form display in your {all_fields}
merge tag you can use the :filter modifier and the [Nested Form Field ID].[Child Field ID] format (e.g., 4.3; where 4 is the Nested Form field ID and 3 is the child field ID from the child form).
You can use the :include, :exclude, :filter, and :index modifiers on the Nested Form field to filter which child fields should be displayed.
Merge Tag | Description |
---|---|
{all_fields:filter[1,2,3.4,3.5]} | In this example, 1 and 2 are field IDs on the parent form. 3 is the Nested Form Field ID and 4 and 5 are field IDs on the child form. |
{all_fields:exclude[3.4,3.5]} | In this example, 3 is the Nested Form field ID and 4 and 5 are field IDs on the child form. |
{Nested Form:1:filter[4,5]} | Show fields 4 and 5 from the child form for this Nested Form field. |
{Nested Form:1:index[0],filter[1]} | Show field 1 in the first child entry from the child form. :index must be paired with :filter. |
{Nested Form:1:index[-1],filter[1]}
to target the last entry and display the value from field 1.Excluding Specific Inputs Within a Field
Fields that contain multiple inputs, such as the Name field, can be excluded per-input by specifying the input ID. For example, to exclude the First Name, add .3
to the Field ID (e.g., 5.3; where 5 is the Name field).
This works for any field that contains multiple inputs, such as Name, Address, and Product. You can find the specific input IDs in Gravity Forms Documentation for Name and Address fields.
Merge Tag | Description |
---|---|
{all_fields:exclude[5.3]} | In this example, 5 is the field ID of a Name field. 3 is the First Name input ID. |
Filter and Exclude Via Custom Function
Custom functions can be used to identify fields for filtering. Using a custom modifier, the function should return an array of field IDs. For example, if you want to exclude fields with personal information from some instances of the {all_fields}
merge tag, you could specify a custom modifier value like so:
{all_fields:exclude[persInfoFields]}
And then create a custom function to identify the IDs of those fields.
add_filter( 'gwaft_modifier_value_persInfoFields', function() {
return array( 1, 2, 3 );
} );
Merge Tag | Description |
---|---|
{all_fields:exclude[customFunction]} | Exclude fields that are returned via customFunction. |
{all_fields:filter[customFunction]} | Show fields that are returned via customFunction. |
This is useful in circumstances when you need to use the {all_fields}
merge tag in multiple places and want to exclude the same fields in several contexts. Instead of having to copy the same string of field IDs to every place you’ve inserted the {all_fields}
merge tag, you can specify the custom function once and use the custom filter wherever you need it. If you want change or add to the excluded fields in the future, you simply update the custom filter and it will be applied everywhere the filter is used.
Customizing the Template
Ok, don’t let this section intimidate you. Here’s the TLDR; Loop through $items
, use $item['label']
for the field label, and $item['value']
for the field value. Here’s the simplest template you could have:
<ul>
<?php foreach( $items as $item ): ?>
<li>
<strong><?php echo $item['label']; ?><strong><br>
<?php echo $item['value']; ?>
</li>
<?php endforeach; ?>
</ul>
You’ll most likely want to use the sample template above as a starting point though as it takes care of a requirements to better align the template with Gravity Forms default All Fields functionality.
Digging Deeper
The {all_fields}
template works like any other WordPress template with one exception. There is a special $items
array available to you.
Each $item
contains a label, value, and field property. The label and value are the exact label and value that the default {all_fields}
merge tag would output. The field is the input-type-specific GF_Field object for the current field. This is useful when you want to alter the way a field is displayed depending on the field you’re working with.
Lastly, you have access to the current entry via the $entry
variable and the current form via the $form
variable. For more details on these variables, see the parameters section below.
Parameters
$items array
An array of items, each item containing the Gravity-Forms-formatted field label, field value and field object for the given field. The field label and field value are the same values that Gravity Forms outputs in the default
{all_fields}
merge tag.$entry Entry Object
The current Gravity Forms Entry object.
$form Form Object
The current Gravity Forms Form object.
Doing more with Gravity Forms
Okay, so with this plugin you can easily handle {all_fields}
data. But what if you just don’t feel you’ve got enough different fields in your Gravity Forms? What if you want to export more fields? That’s where Gravity Perks comes in. Gravity Perks is an essential bundle of 34+ WordPress plugins that add new features for Gravity Forms. Plugins such as…
GP eCommerce Fields
With the GF eCommerce Fields plugin you can easily add eCommerce field types to your Gravity Forms. The new pricing fields include Discount, Tax, and Subtotal. This plugin also improves upon the functionality of Gravity Forms’ Coupons and Shipping fields.
GF eCommerce also adds support for special merge tags for including the subtotal, coupon and conditional-logic-based discount amounts in calculation-enabled fields along with a handy merge tag for displaying the order summary in your confirmations and notifications.
It’s great for helping your users better understand their orders by showing the subtotal before shipping, coupons and taxes have been applied – avoiding any nasty surprises at checkout!
GP Easy Passthrough
Easy Passthrough simplifies transferring entry data from one Gravity Forms form to another. Instead of spending time setting up dynamic parameter names and customizing confirmation query strings, you can passthrough data by setting up an Easy Passthrough configuration.
Entry data is transferred across multiple sessions using the special Easy Passthrough token. This token is a secret key, unique to each entry, preventing random users from guessing at the token and passing through entries they should not have access to.
GP Post Content Merge Tags
This plugin allows you to include Gravity Forms merge tags in WordPress post content, allowing you to, for example
- Implement persistent confirmation pages. For example, you could send the user an email including the confirmation page URL to their form submission, which they could save for future reference.
- Reuse the same confirmation page for multiple forms. For instance, you might have 25 forms on your site but would like to redirect users from all of those forms to a single, personalized “Thank You” page on submission.
- Reclaim complete control over the styling of the redirect page while maintaining the ability to use Gravity Forms merge tags in the content of the page.
These are just 3 of the 34+ plugins in the Gravity Perks collection. Check out the full set of plugins and see what Gravity Perks can do for you today!
FAQs
How do I hide Hidden fields from the {all_fields} merge tag?
You can use the :nohidden
merge tag modifier on the merge tag like this:
{all_fields:nohidden}
:nohidden
hides field output of fields using the Hidden field type. It doesn’t affect to fields set to a Visibility of Hidden.How can I translate the Order Summary label?
You can set a custom Order Summary label using the gwaft_order_summary_label
filter.
add_filter( 'gwaft_order_summary_label', function() {
return 'My Custom Order Summary Label';
} );
Hooks
Questions? Feedback?
What questions do you have? What features are missing? We’d like to make this into a more robust plugin and your feedback will be a big part of shaping the final product.
Did this resource help you do something awesome with Gravity Forms?
Then you'll absolutely love Gravity Perks; a suite of 47+ essential add-ons for Gravity Forms with support you can count on.
I’m using the Gravity Forms Advanced Phone Field plugin, which stores the phone number in a number-only format (no (555) 555-5555 format for the US). Can this be used to format the output of that number in the {allfields} merge tag using the template? I have a client that has requested this.
Hi Dax, we’ve already followed up via email. This should be possible with the Phone Meta Merge Tag modifiers:
https://gravitywiz.com/documentation/gravity-forms-advanced-phone-field/#phone-meta-merge-tag-modifiers
Best,
For some reason we’re getting bullets on each line in Outlook, Gmail doesn’t show the bullets. I’m confused where they are coming from since list-style-type: none is already part of the default template.
Looking for the {all_fields} to visually look like the demo (simple and clean), default template provided. Bonus would be if we could increase the line height between entries. We’re using chained selects and none of the styles in the array seem to effect that section either (simple stuff like trying to change the font-size).
Hi Shane,
Unfortunately, this is an issue with Outlook. Even when an inline style is used to remove the bullets, outlook will remove the inline style.
Best,
Samuel Bassah says
March 21, 2023 at 1:50 pm
Hi Shane,
Unfortunately, this is an issue with Outlook. Even when an inline style is used to remove the bullets, outlook will remove the inline style.
Best,
Samuel,
Thank you for the response. Is this just an issue with Gravity Forms and Outlook then? I don’t see bullets in styled emails I get from any number of companies (order confirmations, form submissions, etc.). I did find some posts using CSS to remove the bullets but couldn’t get it to work.
.gform_body li {background-image: none;}
For the other issue, changing the font style/size in the array doesn’t effect dropdown or select sections. In our example this a consent checkbox and a chained select field. Is there a way to target those fields?
Hi Shane,
The bullet has to do with how Gravity Forms outputs the content of the {all_fields} merge tag, and a possible solution will be to use inline styles to overwrite this. However, I’m unsure how else you can remove the bullets because Outlook removes inline styles. Regarding the other issue, the styles within the array apply to all the field values. If you want to target a specific checkbox field or field type, you’ll have to write some PHP within the items loop and use item[‘field’] to get the field and check if it’s the field you to apply the specific style. If you have an active Gravity Perks license, you can contact us via our support form, and we’ll be happy to assist you further.
Best,
Some styling tips would be awesome. Was trying to get rid of the dated default Gravity output with the alternating table color look and this did that perfectly but I’d like to change the font style to a sans-serif and some other small visual stuff. Adding the font-family property here didn’t seem to work. Not sure where else to put it.
// Change the style a bit for Section fields. if( $field->get_input_type() == ‘section’ ) { $styles[‘li’] .= ‘background-color:#f7f7f7; padding-bottom: 10px; font-family: Arial, Helvetica, sans-serif;’; }
Ha! I’m dumb. I’m also a graphic designer messing with code I don’t understand. I figured it out, the template clearly states the styles are defined in the array. Once I added the property to the “ul” in the array it worked. Thanks again for this!
The client I’m helping is a Gravity Perks Pro sub and sent me here 100% confident you’d have a solution and you did.
Glad you sorted this out Shane!
Is it possible to basically keep the same layout as the regular {all_fields} tag, but show all product fields as regular fields? Not the order summary? I have to use the product field type to use the inventory plugin for limits, but it’s a reservation not a actual order so I don’t want the order summary. However, I still want to only show what is populated. Thanks!
Hi Justin,
You can use the nopricingfields modifier of the {all_fields} merge tag for this. So something like this, {all_fields:nopricingfields} should work for you.
Best,
Hi, Is it possible for the default template to include all forms html blocks? I have 80+ forms tha I need to include the html blocks… it will take quite a while to amend each to include the new merge all field tag.
Thanks Tony
Hi Tony,
You can add this code snippet to your functions.php file and the modifier added to their {all_fields:allowHtmlFields} should now include all HTML fields by default.
Please note that this does not require the All Fields Template to function unless you need the All Fields Template for something specific. I hope this helps.
Best,
Hi Samuel, Thank you for the snippet, that works. I was hoping for a quick fix though so I didn’t have to change the tag on every form (Current tag = {all_fields}
Thanks Tony
Hi Tony,
Sure, can you give this snippet a try. This should work with the {all_fields} merge tags without any modifier.
https://github.com/gravitywiz/snippet-library/blob/master/gravity-forms/gw-include-html-fields-in-all-fields-merge-tag.php
Best,
Perfect!! thank you for the quick respone, just what I needed
Best regards Tony
Hello there!
This script is really helpful and fills a great gap using GF. However is there any chance to create conditional output for certain fields? I’m trying to create alternate styling for fields within your provided starter template for certain fields depending on their ID. Is there any chance to achieve this?
Thank you
Hi Gordon,
This definitely would require some customization to the code snippet. If you have an active Gravity Perks Pro license, you can get in touch with us via our support form so our developers can have a look into this.
Best,
hi guys,
has anyone ever built a template that displays the entries of the nested form like this:
Label1 Label2 Label3 … Value1a Value2a Value3a … Value1b Value2b Value3b … Value1c Value2c Value3c …
does anyone have a tip how i can change the template to this? that would be great – thanks a lot!
…now it has destroyed my formatting in the post. so the labels as a header at the top and then the values below each – if possible not as a table
Hi Bernad,
We have a snippet that displays the Child entry data in a table format, with the labels as the header and the value below each. https://github.com/gravitywiz/snippet-library/blob/master/gp-nested-forms/gpnf-display-child-entries-table-format.php
How do I install a snippet?
I hope this helps.
Best,
Is the plugin download no longer supported? Both the plugin button and the download link just refresh or are anchored on the same page.
Hi Teri,
It seems to be working when testing. It will show a popup to download the plugin.
Another option would be using the View Code button.
Best,
I’m trying to include the contents of a dynamically-populated table (that resides in an HTML field and updates via jQuery), but the only output is the HTML block name and table’s header column names. Is is possible to also capture the table content? If so, is there a way to specify which columns are included/excluded from the notification?
Hi Ryan,
From what I understand this is not supported out of the box and it will require some digging by our Dev team. We’ll be happy to investigate this if you get in touch with us via our Support Form.
Cheers,
Currently I’m handling this by adding the table content (rows) to a hidden textarea via jQuery. It works well and allows me to specify the data that gets passed to the notification, though it also requires a custom script for every form.
Sorry @Dario, I didn’t see your response before I posted a follow up. I’ll send this through the support form.
HI
Is it possible to change the titles to french titles with the plugin ?
Hi Itshak,
You can’t use the All fields Template plugin to translate the Perk tiles. You can however use Loco Translate to translate our Perks. It can generate .po files from our Perk’s included .pot files and doesn’t require using third-party software to convert files.
Best,
Issue – product field values are passed with label, qty, price.
So the price is visible in the product “value” anyway, which means it will show all products (even those not bought).
Hi Kos,
This is how Gravity Forms handles Product fields by default. If you have an active Gravity Perks License, you can get in touch with us via our support form so can dig into this feature.
Best,
Is there any change this does not work when you are using a sage-theme with bedrock? the structure for a theme is different with these themes and for some reason, even if I put the template in the root folder is does not work. I tried the theme root, the resources folder and recourses/views/ no luck.
It this plugin even working on the newest gravityform?
Hi Tim,
This plugin works with the latest version of Gravity Forms. I’m not really familiar with the sage-theme with bedrock. If you have an active Gravity Perks License you can get in touch with us via our support form so we dig into this further.
Best,
Is there an easy way to change the formatting for one field? I’d like to CC emails included in a nested form e-mail field, but with the list formatting I suppose that wouldn’t work.
Hi Noel,
I’ve sent you an email to request additional information on your request. Please check and reply.
Best,
Hi,
Great plugin! Really helped me include HTML fields in the form notifications.
I’m having an issue where there is an additional empty bullet point showing up the form notification – I was wondering if this is a known bug? Or an error on my end?
Here is the html section that the extra bullet point is appearing under (only in the notification email): https://snippi.com/s/q5jfcm0
And here is the form itself: https://www.ourauto.co.nz/contract-form/
Let me know if you need any additional information, and thanks again!
Hi Will,
It could be that there is an HTML missing in the snippet provided. There shouldn’t be any extra bullet points when using the All Fields Template merge tag.
If you have an active Gravity Perks License, you can get in touch with us via our support form with your account email address and we’ll be happy to dig into this further.
Best,
Hi,
how can I filter a column in a list-field?
Hi Ralf,
It appears this is currently not supported. If you have a Gravity Perks license, you can get in touch with us via our support form with your account email, so we can forward this to our developers as a feature request.
Best,
Hi I just saw the update on this and tried to use the nested forms filtering, but when I filter to [0] I get a list. When I filter to [1] or [2], or [3], etc they all work fine. How do I get a result from the first entry?
sorry I mean index. The filter part is working just fine, but when I index [0] I get a list instead of a single field
Hi Mike! This specific issue has been resolved in the latest version of GP Nested Forms (1.0-beta-9.16) which will be publicly available Tuesday 3/30/2021.
I’ve sent you an advanced copy of that build via email for the time being.
Have a great weekend :)
Would this allow me to export my form’s HTML blocks in my notification emails?
Hi Amanda,
Yes, the snippet can allow you to display the HTML blocks within notifications. Once you have the snippet installed, you should be able to use the “include” modifier to output the HTML fields in notifications. The include modifier is written in this format, {all_fields:include[1,2]}, where 1 and 2 are the IDs of the HTML fields you want to include in the notifications.
Best,
I would just love to see notification-email content wihtout the labels of the form fields or without the blue bars in the mail-notification.
Isn’t that possible even without this plugin?
Hello Karl, this is a great question. The all fields template will allow you to take over what is displayed when using the all fields merge tag. You can choose to display value only and not the label. As for blue bars, I am not sure I follow. If you mean each section that is shown and the css behind it , you can customize this within the custom templates we provided. 🙂