After installing this snippet, you will be able to display the number of form entries that have been submitted with the following shortcode:
[gravityforms action="entry_count" id="your_form_id"]
Getting Started
Check requirements
- Make sure you have Gravity Forms installed and activated.
- Already have a license? Download Latest Gravity Forms
- Need a license? Buy Gravity Forms
- Make sure you have Gravity Forms installed and activated.
Install the snippet
- Copy and paste the entire snippet into your theme’s functions.php file.
Configure the shortcode
- For the basic version just enter your form id and the shortcode will return the total number of submitted entries!
- If you would like to have a little more control over the type of entry being pulled, read on for some additional configuration options.
- View available shortcode attributes
Usage Examples
Basic Usage
[gravityforms action="entry_count" id="your_form_id"]
[gravityforms action="entry_count" id="2"]
Unread Entries, Comma Format
[gravityforms action="entry_count" id="2" status="unread" format="comma"]
Display the entry count for unread entries using comma format (i.e. “1,001”).
Trashed Entries, Decimal Format
[gravityforms action="entry_count" id="2" status="trash" format="decimal"]
Display entry count for entries in the trash using decimal format (i.e. “1.001”)
Shortcode Attributes
id (int) (required)
The ID of your form. Defaults to false.
status (string) (optional)
The entry status type that you would like to display number of entries submitted for. Defaults to “total.” Options include: “total”, “unread”, “starred”, “trash”, and “spam”.
format (string) (optional)
The type of formatting to be used when displaying the entry count. Defaults to false. Options include: “comma” and “decimal”.
How’d we do?
If you use it and like it, let us know. We’d love to hear the different ways you found this code useful!
Learn more about Gravity Forms Shortcodes
Our Complete Guide to Gravity Forms Shortcodes will show you each type of shortcode available for Gravity Forms, how to set them up, as well as how to fine tune parameters to customize which form data is displayed on your pages.
Did this resource help you do something awesome with Gravity Forms?
Then you'll absolutely love Gravity Perks; a suite of 46+ essential add-ons for Gravity Forms with support you can count on.
Is there a way to count how far “down” an entry is. For example, building a waitlist, I want to know what position a entry is, are they 10th in line, 20th in line. I was thinking I could get the entryID of the first one and then subtract the the differences of everything. However, entryIDs are not in order. Meaning if I create another entry in another form and then add a new one to this form, it is not sequential. Plus if you use random entryIDs, then it all goes out the door.
Hi,
You can use our GP Unique ID Perk to generate sequential IDs that will be specific to the entries of a form. This should work better for what you’re trying to do.
Best,
Hello! and how do I set the counter to “0” again?
Can it be reset or is that not possible?
Thanks
Hi Paolo,
This snippet counts how many entries were submitted. If you need to tweak the snippet you can get in touch with us via our support form if you have an active Gravity Perks license so we can take a closer look at your setup.
Best,
I did not want the count to display until it had reached a certain threshold. I tweaked David’s fine script to provide for this. Two optional fields are used: display_min (a number) and display_min_alt_text (alternate text).
http://snippi.com/s/d32esuf
Dean
Hi Dean,
Thanks for sharing with the community. We already followed up on this via email, but I wanted to post this in the comment thread so other customers could see it.
Cheers,
Hi there
Nice bit of code. I am showing the number of entries of the form – all good. But I also want to add a number to this every so often that reflects offline forms that are physically collected. Is there a way to do this?
Hi Steven,
We don’t have a ready solution for this one. If you don’t collect many offline, you could enter the physical form data into the Gravity Form.
Is it possible to show only last 7 days entries?
Hi Mareks,
This isn’t currently supported. If you are a Gravity Perks customer with an Advanced or Pro license, drop us a line and we can look into adding support for this.
Hello,
When I try to run this shortcode via do_shortcode, I get an error.
Here’s the PHP I’m using:
echo do_shortcode(“[gravityforms action="entry_count" id="1" format="comma"]“) . ‘ people have taken the pledge to…’;
I’ve tried to escape the quotes inside the do_shortcode function, but when i do that the shortcode isn’t even recognized.
Here’s the error I’m getting:
Parse error: syntax error, unexpected ‘entry_count’ (T_STRING), expecting ‘,’ or ‘)’ in pledgetally.php on line 3
You’ll need to use single quotes to wrap the shortcode.
'[gravityforms action="entry_count" id="1" format="comma"]'
I actually tried that. When I did that the error said that do_shortcode was an unrecognized function.
I’m currently using this shortcode but I’m wondering how to tweak it so it can display the number of entries from multiple forms. How can I add multiple for ids?
I would also like to know if this is possible… I am having a case where I need to show the total number of entries from multiple forms that are related to each other.
Hi Joeri,
This isn’t currently supported. If you are a Gravity Perks customer with an Advanced or Pro license, drop us a line and we can look into adding support for this.
Best,
This looks great, Is there anyway to display entries sent to a certain author email ? I currently use the below code to email the author of a particular page when a form entry is made.
What id like to do is create a page where that author can then see the entries which has been submitted to him, your code seems to do that, but obviously it would display ALL entries for that form, could someone help with what code id need to use narrow it down only authors saw their own entries from the same form.
It looks like this might help: https://wordpress.org/plugins/gravitywp-count/
Hi David! How to display sum of entries from date range? How to set start and end date and get the amount on a specific field?
Hi Alex, we do not currently have a solution for this.
Today I modified this shortcode and it works as [donations form=9 start_date=”2017-02-01″ end_date=”2017-02-03″] But I don’t know how to make input on HTML page: