Dear Sir/Madam,
I want to create a page using Views to display the events by decreasing date order but in separated section by month. (see screenshot)
May I know how I can achieve it?
Best regards,
Kelvin
Dear Kelvin,
Here is a document about "How to group Views results by year and month":
https://toolset.com/2013/10/how-to-group-views-results-by-year-and-month/
Hope it help
Dear Luo Yang,
How can I use the View Query Filter to filter the custom post with a custom date field "press_date". I want to list out all the post which date if after this month. I try to set the filter press_date is a DATE greater than THIS_MONTH() but no result. I ensure there is a post with press_data in Jun (see screenshot).
Bet regards,
Kelvin.
Dear Kelvin,
The custom date field created with Types, which stores value as time-stamp (numeric) value, so you will need to change the option "DATE" to number, see our document:
https://toolset.com/documentation/user-guides/date-filters/
screenshot:
hidden link
Dear Luo Yang,
Thanks for your reply. I finally can filter the post with custom field date after this month (see screenshot).
How can I pass a variable to the field after FUTURE_MONTH instead of giving a fixed number? I want to reapply this Views on different condition.
Best regards,
Kelvin.
Dear Luo Yang,
Before having the parameter passing solution, I temporary create 3 Views to filter the future, this month and past post. Refer to the screenshot I attached, there is a post which press_date is May 16, 2016 (this month), at what reason why the View cannot filter this post but only can filter the future and pass post? I did set the press_date is number and equal to THIS_MONTH.
Please advise.
Best regards,
Kelvin.
Q1) How can I pass a variable to the field after FUTURE_MONTH instead of giving a fixed number?
You can try add your custom " different condition" with Views filter hook wpv_filter_query, here is the document:
https://toolset.com/documentation/user-guides/views-filters/wpv_filter_query/
Q2) at what reason why the View cannot filter this post but only can filter the future and pass post?
As I mentioned above, the types custom date field stores time-stamp value, which include year + month + day + hour + minute + second
When you setup the filter as equal to this month, it means the date field equal to 2015-05-01 00:00:00
But the problem post field is setup 2015-05-16 00:00:00
So it isn't equal to, you will need setup the filter as between this month and next month
Dear Luo Yang,
Thanks for your reply. the THIS MONTH issue fixed.
For the custom " different condition" with Views, I have no idea how it works. Is it possible to take my case as sample what I should do from the Views?
According to our new Customer Support Policy, we do not provide custom codes support, and here is a similar thread for how to use filter wpv_filter_query to add filter by custom date field:
https://toolset.com/forums/topic/make-date-between-inclusive/
For your reference.