Skip Navigation

[Resolved] Creating a reusable list form item

This support ticket is created 3 years, 8 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Our next available supporter will start replying to tickets in about 4.75 hours from now. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

Author
Posts
#1966051

I am going to create multiple post types, each with its own form for site members to fill out. Several of the forms will have a long dropdown list to choose from. Because the same dropdown list will appear in multiple forms, is there a way to create this list somewhere where it can be dropped into multiple forms?

#1966275

Hi,

Thank you for contacting us and I'd be happy to assist.

To dynamically populate a list of options for a "select" type custom field, you can use the "wpt_field_options" filter:
https://toolset.com/documentation/programmer-reference/types-api-filters/#wpt_field_options

For example, in this reply, I've shared an example code snippet to populate a list of options for the field with the title "Dogs Sire", from a custom post type "dogs":
https://toolset.com/forums/topic/custom-field/#post-1190447

In this case, all posts from this post type will be used as an individual option in the select field, with the post title as the option title and the post ID as that option's value.

To have a reusable dynamic list, you can also add a custom post type that holds all these options as posts and populated them in the required fields, using the "wpt_field_options" filter.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

#1967269

Waqar,

Thank you for responding to my question. I'm sorry to say that I have no programming experience, so I did not understand your response or how to incorporate it into my site design.

Is the only way to accomplish this using code? If so, I may just go through the trouble of inputting the list multiple times manually for now.

Thanks again, Sean

#1967333

My issue is resolved now. Thank you!