PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Dynamically populating Radio Buttons with featured image from Custom Post Type

  1. I'm looking for a way to allow users to select an image which gets pulled in from a custom post type's featured image.

    For instance, I have a custom post type for adding / removing the images and related info.

    The form would then need to pull in all of the items within that custom post type, and dynamically load their featured images as radio button selections in the radio button field for users to choose from.

    I know I can add HTML to a radio button label, and how to dynamically load custom post type names into a drop down, but not sure how I would dynamically load in the featured images as radio buttons. Any thoughts on how I could build that out with GF?

    Thanks,
    J

    Posted 11 years ago on Wednesday March 6, 2013 | Permalink
  2. I just explained something very similar, to set the featured image on a post from a radio button selection in the form.

    http://www.gravityhelp.com/forums/topic/display-featured-image-selection-based-on-conditional-logic#post-162117

    That code will probably help with at least some of your project.

    Posted 11 years ago on Wednesday March 6, 2013 | Permalink
  3. Hi Chris,
    Thanks for the link - but this is actually the opposite of that. I'm looking for a way to pull the featured images from a collection of custom post type posts into a radio button field as the radio buttons.

    Basically providing a way to dynamically show available stock items that will change, that users can select from visually while completing the form.

    Any insight on accomplishing?

    Thank you,
    Jonathon

    Posted 11 years ago on Thursday March 7, 2013 | Permalink
  4. Or, any other way to dynamically set radio button choices with images?

    Posted 11 years ago on Saturday March 9, 2013 | Permalink
  5. I see what you mean now. You would use the same process as populating a drop down, but you would populate the label for the radio button with the html for the image, and the value of the radio button with your value. I did not find any examples here of anyone doing the same, but I did find this: http://wpsmith.net/2012/plugins/how-to-pre-populate-a-radio-select-field-in-gravity-forms-based-on-previous-inputs/

    In this code from that page: https://gist.github.com/wpsmith/2790690/raw/b5a83a3f86e502e85f4e4d5a58964f5ba3c67bba/prepopulate_radio.php

    he shows how to populate radio buttons. You could combine what you know about populating a drop down with custom post names with this explanation of how to populate radio buttons.

    Posted 11 years ago on Wednesday March 13, 2013 | Permalink