Skip Navigation

[Resolved] filter by time-of-day

This support ticket is created 3 years, 9 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 – 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+00:00)

This topic contains 1 reply, has 2 voices.

Last updated by Jamal 3 years, 9 months ago.

Assisted by: Jamal.

Author
Posts
#1689465

Tell us what you are trying to do?
filter these results: hidden link by time-of-day: morning, afternoon, or night

we currently only have meeting time in the database. Is there way to compute all morning meetings (all meetings up till noon), afternoon meetings (all pm meetings up till 6pm), and night meetings (all meetings between 6pm and midnight).

Is there any documentation that you are following?
no

Is there a similar example that we can see?
no

What is the link to your site?
hidden link

#1690273

Jamal
Supporter

Languages: English (English ) French (Français )

Timezone: Africa/Casablanca (GMT+00:00)

Hello and thank you for contacting the Toolset support.

There is no built-in way to perform this filtering based on the date custom field. The straight forward way is to add a select custom field to the custom post type to track the day period. You can then sync the value from the date custom field using custom code hooked to save_post. Then you will have to save all current posts to sync the field value. Then you can add a filter around the custom field.
https://developer.wordpress.org/reference/hooks/save_post/

You may also create use a query filter to look for the post between two dates passed as a URL param, then you can create a custom filter(period selector) and add custom Javascript that will sync the "start_date" and "end_date" field from the filter value.

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

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.