You can use the Gravity Forms API to filter the form entries based on the value of the franchise_location field. You can use the GFAPI::get_entries()
function to retrieve the form entries and then the GFAPI::count_entries()
function to filter the entries based on the value of the franchise_location field.
Here’s an example of how you can filter the form entries based on the value of the franchise_location
field:
$form_id = 1; // ID of the Estimate form
$franchise_location = 'miami'; // Value of the franchise_location field
$search_criteria = array(
'field_filters' => array(
array(
'key' => 'franchise_location',
'value' => $franchise_location
)
)
);
$entries = GFAPI::get_entries($form_id, $search_criteria);
You can then use this variable $entries
to display the form entries on the dashboard, where only the form entries that contain the franchise_location with a value of ‘miami’ will be displayed.
Alternatively, you can use the GFAPI::count_entries()
function to retrieve the number of form entries that match your search criteria and then use that number to display the form entries on the dashboard.
$entry_count = GFAPI::count_entries($form_id, $search_criteria);
This is a possible way to do this using the Gravity Forms API, but you can also use other methods like pre_get_posts
and posts_where
. It depends on your specific use case and requirements.