Skip Navigation

[Resolved] Sort view results on custom date field

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

Problem:
The issue here is that the customer wanted to be able to sort his view by his custom date field as well as filter it for only the upcoming events.

Solution:

To sort a view by your custom field you will need to go to the ordering section of the view and then select the field you want to sort the view by and then select ascending or descending order for the view.

Finally to filter the view you can have a look at the link below.

Relevant Documentation:
https://toolset.com/documentation/user-guides/date-filters/

This support ticket is created 6 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 6 replies, has 2 voices.

Last updated by Marcel 6 years, 11 months ago.

Assisted by: Shane.

Author
Posts
#602575

Tell us what you are trying to do?

I made a custom date field for WooCommerce products and I try to sort the results on that field, with the first date in the future as the first result.

Is there any documentation that you are following?

I tried to make a filter using https://toolset.com/documentation/user-guides/date-filters/, but I can't get it to work.

#602653

Update: I found out how to sort on my custom date field. I still need help on how to hide dates in the past though.

#602655

Shane
Supporter

Languages: English (English )

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

Hi Marcel,

Thank you for contacting our support forum.

Would you mind providing me with access to the view so that I can have a look at this for you ?

The private fields will be enabled for your next response.

Thanks,
Shane

#602733

Shane
Supporter

Languages: English (English )

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

Hi Marcel,

What do you mean when you say you want to hide the posts in the past ?

Meaning you want to limit your views to like the 10 most recent posts or 20 ?

Please let me know.
Thanks,
Shane

#602738

I used toolset to add a date, time and location to woocommerce products so I can use them as events. In the view, I only want the upcoming events to show, so not the events in the past.

So at this moment, an event is shown with the date being 23th of December 2017. Since it's already past that date, that event should not appear anymore.

#602789

Shane
Supporter

Languages: English (English )

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

Hi Marcel,

Thanks for the clarity.

I've added a filter to the view that allows it to only display future events.

Please let me know if this helps.
Thanks,
Shane

#602791

Yes, this is exactly what I meant, thanks 🙂 I treid the same filter before, but I used "date" instead of "number". That didn't work.