instagram rss arrow-down

This is a simple way for displaying Gravity Forms Entry Counter with a Shortcode. It extends Gravity Forms shortcode by providing a custom action and retrieving the total Gravity Forms entry count for a specific form ID.

This is what you need to do to activate Gravity Forms Entry Counter:

  1. Install the Gravity Forms
  • If you don’t have a Gravity Forms installed, you can buy it here.

2. Paste this code snippet

  • Paste this entire snippet at the end of your themes functions.php file.

3. Use the Shortcode on page

  • To display the simple Gravity Forms Entry Counter, use the basic shortcode. Simply add your form ID and the shortcode will return total Gravity Forms entry count.
  • You can modify the shortcode to display Gravity Forms count by status and you can set the format. Statuses are: total, unread, starred, trash, spam; and formats should be comma or decimal
add_filter( 'gform_shortcode_counter', 'wpbrainery_counter_shortcode', 10, 2 );
function wpbrainery_counter_shortcode( $output, $atts ) {

    extract( shortcode_atts( array(
        'id' => false,
        'status' => 'total',
        'format' => false
    ), $atts ) );

    $valid_statuses = array( 'total', 'unread', 'starred', 'trash', 'spam' );

    if( ! $id || ! in_array( $status, $valid_statuses ) ) {
        return current_user_can( 'update_core' ) ? __( 'Invalid form ID or form status parameter.' ) : '';

    $counts = GFFormsModel::get_form_counts( $id );
    $output = rgar( $counts, $status );

    if( $format ) {
        $format = $format == 'decimal' ? '.' : ',';
        $output = number_format( $output, 0, false, $format );

    return '<div class="gcounter">You asked for our help <span class="counter_number">' .$output. '</span>' . ' times.</div>';

And a little bit of CSS:

.gcounter {
    text-align: center;
    font-size: 24px;
.counter_number {
    font-weight: bold;
    color: #3a589e;

You can paste the CSS code to your themes custom CSS editor.

Basic Shortcode for Gravity Forms entry counter


Displaying Unread Entries Counter with decimal format


  • id(int) – required. Your Form ID. Default = false
  • status(string) – optional. Default = total. Options are: “total”, “unread”, “starred”, “trash”, and “spam”.
  • format(string) – optional. Default = false. Sets the type of formatting when displaying the entry count. Options are comma or decimal.

gravity forms entry counter


Did you find this snippet useful? We hope you did!

Support New Articles with a Sweet Tee

One comment on “Gravity Forms Entry Counter with Shortcode

  • Rick Smith
    August 16, 2018 | 11:11 am

    This shortcode didn’t work for me. I added the code to the functions.php of my child theme. It only returns [gravityforms action=“counter” id=“31”] displayed on the page

Leave a Reply
Your email address will not be published. Required fields are marked *