Skip Navigation

[Resolved] Filter results by a specific future MONTH using custom date field

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

Problem: I would like to set up a filter on a custom date field that will only show results from a specific month, in this case July.

Solution: If you want to select posts in July, I recommend using custom date field as a "number" and filtering results between two DATEs. See the screenshots below for an example.

Relevant Documentation:
https://toolset.com/documentation/user-guides/date-filters/
https://toolset.com/documentation/user-guides/filtering-views-query-by-date/

This support ticket is created 6 years, 10 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by Rita 6 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#536471
Screen Shot 2017-06-14 at 08.36.30.png

Hi there

I am having a problem getting my view to show only posts for a specified future month... I didn't think it was complicated but I can't get the view to render the correct results...

My set up is:

1. A custom post type called 'Events'

2. A custom field group linked to that post type called 'Event Group'

3. A custom field within that group called 'event-date-start' (users create events using a CRED form and must specify a start date using this custom field)

4. A view of all 'Event' posts with a filter to display only those events with a custom field date set in July (see screenshot image)

I want to:

Display a view for each month of the year that displays all the events within a specified 'future' month.
So one view would display all events that start in July.

I have read all the discussion forums and documentation I can find and followed all the instructions but can't get the view to work. I am obviously doing something wrong but I don't know what... Please help?

Here is the page where you can see what I am trying to achieve. (View the 'Jul' tab because this is the only one I am working on at the moment) - hidden link

Rita

#536638
Screen Shot 2017-06-14 at 9.13.46 AM.png

Hi, I'll try to explain in clearer terms how you can accomplish this. First, the FUTURE_MONTH (07) filter will find results in a month 7 months from the current date. So this won't always be July...it will vary depending on the current date when the user visits your site. If you want to select posts in July, I recommend using custom date field as a "number" and filtering results between two DATEs. Please see the attached screenshot showing this in a View's Query Filter.

In your case, you want to show posts between July 1 and July 31, so I have selected the appropriate values. Please let me know if I have misunderstood your request, or if you need additional information. Thanks!

#536917

Perfect explanation Christian thank you.
My little 'calendar' is complete and working very nicely. 🙂

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