Skip Navigation

[Resolved] Sorting post types by custom field

This support ticket is created 2 years, 11 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.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 1 reply, has 2 voices.

Last updated by Shane 2 years, 11 months ago.

Assisted by: Shane.

Author
Posts
#2326931

Tell us what you are trying to do?
I have a view with a filter. I have the filter set to post date/descending. I want to for the post types in the view by a date in a custom field.

Here's a link to the page: hidden link
When I chose certain things in the drop down the post types are in the order I want. For example, when I sort by "All" the post types are in the correct date order. When I chose "Advisory" they are not in the correct order. The dates are ascending instead of descending. I think it's because of the date and time I entered the posts but I'm not sure. I want to sort the transaction posts by a date in a custom field.

Here are the login credentials:
[redacted]

#2327097

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi John,

Thank you for getting in touch. The problem here is that your posts are being sorted by their post date. In order for the date custom field to show in the correct order you will need to sort your view by the date custom field.

However I saw that your transaction date field is a string field and not an actual date field. Because of this we won't be able to get an accurate sorting of the post.

My recommendation here is if you're able to use a datepicker for your transaction date field then this would help better with the sorting as it would provide values that are sortable.

Thanks,
Shane