Skip Navigation

[Resolved] Ordering a Select list in Alphabetical order

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.

This topic contains 5 replies, has 2 voices.

Last updated by Minesh 1 year, 4 months ago.

Assigned support staff: Minesh.

Author
Posts
#1653469

I have added a list of Timezones as a select field, however there are 300+ items. How can I reorder them in alphabetical order without manually draggin around?

#1653733

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

I would like to know where those 300 timezone items stored. Do you have database table that holds those 300 timezone values or where those 300 timezone values are currently stored?

#1653881

No, I have added them to Toolset as Options for a select.

#1653939

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You mean you already added 300 select options to your Types custom select field and you want to display those options in specific order. If yes: you need to reorder manually to display it in specific order on your post type add/edit screen.

If you want to display that select filter as view's frontent filter, then when you try to add the custom select field as filter, we have a option for sorting available.

#1654069

Is there a better way to get a list of Timezones populated so that I can use it on my custom type?

#1654075

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

If you have list of your timezones stored in any database table or as post type then you can populate the custom select field options dynamically using the Toolset Types hook: wpt_field_options
=> https://toolset.com/documentation/programmer-reference/types-api-filters/#wpt_field_options

Please check the following related ticket:
=> https://toolset.com/forums/topic/setting-multiple-options-all-the-countries-in-the-world-for-a-select-field/#post-1219399