Is it possible to do a query_posts and return all the titles/id for the gravity forms?
what we are trying to do is assign specific forms on specific pages dynamically..
Is it possible to do a query_posts and return all the titles/id for the gravity forms?
what we are trying to do is assign specific forms on specific pages dynamically..
No, you can't use query_posts like that because each form is not a post.
What some people have done is matched the name of the form to the name of the page, and included the form dynamically with a function call. Or, you can store the form ID as a custom field an include it that way.
Please explain more about how you need this to work and I'm sure we can come up with something for you.
The idea is assign the form id dynamically to a page/form using metabox.
How can i retrieve the list of the forms?
Is there a hook for that?
You can use this to get a list of forms. This code is present in form_list.php:
[php]
$forms = RGFormsModel::get_forms("active", "title");
The get_forms function is defined in forms_model.php if you'd like to take a look at it.
is it safe to do something like this in a custom plugin
$forms = $wpdb->get_results( "SELECT id, title FROM wp_rg_form where is_active=1" );
It's safe but unnecessary, and would not necessarily be future proof. There's no need to go direct to the database like that, but if it gets the job done for you, it's not hurting anything.