Blog Featured Dropdown

By default, Gravity Forms provides a stock dropdown field. The values of this field are static and, normally, you would type them in or copy/paste in bulk.

That’s all great but what if you want to set the values of the dropdown dynamically? Below is how you do it:

  1. Define the classes of the dropdown fields that you want to accept the dynamic fields
  2. Check that the type of the current fields is “select” and its class is matches one of the classes defined above
  3. Compile an array of the dynamic values and save it in the $field[‘choices’] array element

This example uses all the published entries of the “partners” custom post type as values for the dropdown.

 

 

Anton Zaroutski

WordPress Specialist, Front End and PHP Developer, @xeiter

Leave a Reply

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