Reputation: 3853
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!
Upvotes: 2
Views: 6770
Reputation: 141
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'];
Upvotes: 4