Skip Navigation

[Resolved] Dynamic Select Field

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.

This thread is resolved. Here is a description of the problem and solution.

Problem:
Create a dynamic select field in Custom Fields, (pull data from custom taxonomy)
Solution:
Here is custom solution:
https://toolset.com/forums/topic/dynamic-select-field-2/#post-618618
Relevant Documentation:

This support ticket is created 6 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 12:00 – 17:00 -
- 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 18:00 – 21:00 -

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

Author
Posts
#617391
chrome_2018-02-19_04-09-21.png
chrome_2018-02-19_04-10-15.png

I am trying to: Create a dynamic select field in Custom Fields, (pull data from custom taxonomy)

Link to a page where the issue can be seen: please see screenshots

I expected to see: Populated select field from Taxonomy

Instead, I got: I tried to implement the code from this link, but I got nothing.
https://toolset.com/forums/topic/i-wish-i-could-load-a-custom-select-with-options-from-a-custom-taxonomy/

please advice,

Thank you,

#618618

Noman
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

2.png
1.png

Hi Abraham,

Thank you for contacting Toolset support. Here is basic example of dynamic select field options:

add_filter( 'wpt_field_options', 'fill_select', 10, 3);
function fill_select( $options, $title, $type ) {
	
    if ($title == 'Dynamic select field')  {
        $options = array();
            $options[] = array(
                '#value' => 'test_id',
                '#title' => 'test_val'
            );
    }
	return $options;
}

And it’s working fine as in attached screenshot. You can change options array values according to your needs.

Please note, if you adds the options with this filter (wpt_field_options) they will not work in Toolset Views as custom filters.

We have a feature request posted to our development team and we are hoping that it will be added in the future. You may subscribe to our blog as we announce updates and new features there:
https://toolset.com/blog/

Thank you

#622412

Thx for your help Noman.

The forum ‘Types Community Support’ is closed to new topics and replies.