Skip Navigation

[Resolved] View to display all existing values in a field

This support ticket is created 3 years 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 0.79 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: Africa/Casablanca (GMT+01:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by szymonF 3 years ago.

Assisted by: Jamal.

Author
Posts
#2220097

Posts on my site have a custom field 'contributed by', where I list the names of the people who supplied materials for a given post. I use this to display their names in each post to credit their work.

I would also like to create a list of all contributors. I thought I could make a view which would display them all. So all the view is displaying is the content of this one custom field in alphabetical order. But naturally I don't want it to display the same contributor twice. Is there a way to set up the view so that it only displays the content of a field if the same content hasn't already been displayed?

#2220645

Hello and thank you for contacting the Toolset support.

This cannot be built by Toolset without some custom code. And even if we produce some custom code that is based on a Toolset view, it would not be optimal. The best solution is to build a custom shortcode that will directly query the database and return distinct values of the field. Check these online threads:
- https://stackoverflow.com/questions/9281095/wordpress-get-all-values-of-a-custom-field
- https://wordpress.stackexchange.com/questions/9394/getting-all-values-for-a-custom-field-key-cross-post

Please note that I assumed you are using Toolset fields that accepts multiple values. If that's the case, each value is stored in its own row, and a "Select distinct" will return the expected results.

If on the other hand you are separating values using a comma, you will need a different solution.

Note that Toolset fields are prefixed by "wpcf-", which means a field with slug "school" will have a meta_key "wpcf-school".

I hope this helps. Let me know if you have any questions.

#2222477

Thank you, I will look this up!