WordPress.org

Ready to get started?Download WordPress

Forums

Gravity Forms - Dynamically populate drop down menu... WITH CUSTOM FIELDS! (1 post)

  1. Olly - OWMC
    Member
    Posted 4 months ago #

    Hi,

    Not getting the best of support from Gravity Forms. I have a dropdown menu in my form.

    I want to populate this drop down with text from a custom field in a custom post type. Using this code. I am able to populate the menu with the posts' titles. But how do I modify my code so that it displays the values from my custom field instead of the title?

    Gravity Forms support just told me I'm going to have to customise the code snippet. Instead of get_posts, I will need to use a WordPress function to get all my custom field names. But that's as far as the support has gone so far.

    I've used get_post_meta($post_id, 'custom_field_name', false) like so:

    http://pastebin.com/2fmqRb3T

    (I've replaced 'custom_field_name' with the actual field name obviously)

    But it just returns a drop down menu with blank choices repeated. There appear to be 8 blank choices which is the number of posts I'm calling within that category. So something is right, but I'm really not great with php. Can anyone tell me where I'm going wrong?

    Any advice, tutorials... anything, this has stunted me for days.

Reply

You must log in to post.

About this Topic