2
votes

I'm using the gravity forms wordpress plugin.

And I am trying to echo the entry count on form #1 - in my wordpress theme files.

I can't seem to find anything on how to do this - does anyone know a filter/action I can add to my functions to do this?

Really appreciate any ideas, thank you!

1
i think you had purchased the plugin. So you will get a premium support at Gravity forms forum - Libin
@libin - yeah their support is awesome!!! but my 2 year premium support run out a couple of weeks ago :( - Joshc

1 Answers

4
votes

Here are two methods.

Method 1 - Writing your own SQL Query

function get_entry_count($formid)
{
    global $wpdb;
    $count = $wpdb->get_results("SELECT COUNT(*) as count FROM wp_rg_lead WHERE form_id=$formid" );
    return $count[0]->count;
}

echo get_entry_count(1);

Method 2 - Using GravityForms Built in function.

$formid = 1;
$form_count = RGFormsModel::get_form_counts($formid);
// Displaying Total Entries
echo $form_count['total'];