Documentation

Shortcode gravitywp_count

The gravitywp_count shortcode you can count, filter and display the number of Gravity Forms entries or the total of a number field for multiple entries.

Most simple version of the shortcode (display number of total entries Gravity Forms for a form):

[gravitywp_count formid='']

Or when you want the total of the values in a number field (display the total of the number field values for all entries a specific Gravity Form):

[gravitywp_count formid='' number_field='']

The most extensive version of the shortcode (display the total count of a number field from multiple Gravity Forms entries with up to five filters and input for number of decimals, the decimal point notation and the thousand seperator, etc, etc):

[gravitywp_count formid='' formstatus='' number_field='' filter_mode='' filter_field='' filter_operator='' filter_value='' filter_field2='' filter_operator2='' filter_value2='' filter_field3='' filter_operator3='' filter_value3='' filter_field4='' filter_operator4='' filter_value4='' filter_field5='' filter_operator5='' filter_value5='' decimals='' dec_point='' thousands_sep='' is_read='yes' is_approved='yes' is_starred='no' created_by='1' multiply='2' start_date='12/31/2016' end_date='12/31/2017' workflow_step='' workflow_step_status='complete' workflow_step_is_current='true']

Available settings

SettingValueInformation
formidabsolute number (Form ID)For which form do you want to count entries?
formstatusdefault ‘active’, other options: ‘spam’, ‘trash’, ‘all’What should be the status of the form?
number_field absolute number (Field ID)OPTIONAL, if set it will return the total sum of the number field values for all the (filtered) entries in the form
filter_mode default: ‘all’ | other options: ‘any’All filters should match or any filter should match
filter_field absolute number (Field ID to filter)Which Field ID should be used to filter?
filter_operator default: ‘is’ | other options: ‘isnot’, ‘not_equal’, ‘greater_than’, ‘less_than’, ‘contains’, ‘starts_with’, ‘ends_with’Which operator should be used to filter the results?
filter_value custom valueOn what value should be filtered?
decimals absolute numberHow many decimal places should be shown?
dec_point default point ‘.’ | optional custom valueWhat should be used as a decimal point (for example ‘.’ or ‘,’)
thousands_sep default comma ‘,’ | optional custom value What should be used as a thousands separator (for example ‘.’ or ‘,’ )
is_readdefault empty | options: ‘yes’ | ‘no’Filter entries if they are read or not read
is_approveddefault empty | options: ‘yes’ | ‘no’ Filter entries if they are approved or not
is_starreddefault empty | options: ‘yes’ | ‘no’ Filter entries if they are starred or not
created_byuser ID like ‘1’ | optional ‘current’Only count entries from a certain User ID or the currently logged in user
multiplydefault ‘1’ | optional decimal point notation number Multiply the result
add_numberdefault ‘0’ | optional custom numberAdds a number to to the final result
start_datedefault false | optional date formatted like 12/31/2016 (mm/dd/yyyy)Count only entries after the start_date.
end_datedefault false | optional date formatted like 12/31/2017 (mm/dd/yyyy) Count only entries before the end_date.
workflow_stepworkflow step IDFill in the workflow step ID here to use as a filter. Count only entries that are at this step.
workflow_step_statuspending | complete This is a comma seperated string. You can use one or both of the following options: pending,complete.
workflow_step_is_currentdefault ‘true’ | optional ‘false’this can be set to true or false. If set to false, it will count everything that is in workflow steps after the selected workflow_step (including the selected workflow_step)

How do I show only the count for the current logged-in user?

If you only want to show the total entries or the count of a number field for the currently logged-in user, you can use

created_by="current"

How to use the shortcode for counting entries?

Here you find the shortcodes to count the total of entries (with or without filters). You will notice that you don’t have to fill in decimals or decimal points, because these shortcodes only count the total of entries (which is always a whole number). It is possible to define a thousand seperator.

[gravitywp_count formid="2" thousands_sep=","]

or use the default (thousand separator is a comma):

[gravitywp_count formid="2"]

formid: This is the id of the form you want to target your shortcode at. It’s in orange
thousands_sep: The thousands seperator is to, what it says, the notation you use to seperate thousands. In the USA this is a comma, in Europa this is a point. For example a million in USA is: 1,000,000.00 and in Europe it is: 1.000.000,00. You can define the thousands seperator in the shortcode.

How do I use values to filter the results?

You can use filters to only show the calculations you want (based on fields in the form). To use one filter, use this shortcode:

[gravitywp_count formid="2" filter_field="3" filter_value="IT developer" thousands_sep="," ]

filter_field: this is the Field ID you want to use in your filter. Go to your Gravity Form, go to the Field (text, dropdown, radio button) you want to use as your filter and write down the Field ID number to use in filter_field in your shortcode.
filter_value: write here the exact value that is in your text, radio button or dropdown. If you clicked ‘show values’, use the text under Value (don’t use the label).

With 2 filters

[gravitywp_count formid="2" filter_field="3" filter_value="IT developer" filter_field2="5" filter_value2="41 and older" thousands_sep="," ]

filter_field2: this is the Field ID you want to use in your second filter.
filter_value2: write here the exact value that is in your text, radio button or dropdown (for the second filter!). If you clicked ‘show values’, use the text under Value.

You can use up to 5 filters.

Last updated: 07-02-2024

Countv0.9.8

For this plugin you need to install the free GravityWP - Count from the WordPress repository.

Read more