Skip Navigation

[Closed] Setting filter for postdates

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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Tagged: 

This topic contains 17 replies, has 3 voices.

Last updated by Beda 6 years, 1 month ago.

Assigned support staff: Beda.

Author
Posts
#324016

Glad to hear that it now works!

This your approach seems perfect, as far I understood your goal.
It will not "break" on years switch, as we query Weeks here, not related to years at all.

My approach was partially wrong, as you correctly recognized, it matched this weeks and the past (being 2 weeks in past) week posts, instead of the past (2 weeks in past) and the further coming ones.

Though, with your code you will also match FUTURE posts, if you have such ones in your system.
If you don't have FUTURE posts, it will not affect your Query results.

So it will always return "lats's 2 Weeks" (or after) matching dates, which would also include the last week of a "year's end", and the first week of a "new's year"

Please let me know if you have further questions regarding the issue mentioned in this Thread

Thank you for your patience.

#325053

The last question I have is the following:

Now I do have a fixed "week:PAST_ONE(2)" . Would it be possible to use a short code for this, so you can 1 view with various timeslots?

#325233

Thanks for the Details

Filtering by short code attributes allows you only to filter by valid values:
https://toolset.com/documentation/user-guides/filtering-views-query-by-date/

When passing values into the View, or when using fixed values, you need to set valid ones. When setting a year value, it must have a four digit format. Month values go from 1 to 12 while day values go from 1 to 31. Hour values go from 0 to 23 while minute and second values go from 0 to 59. Week values go from 1 to 53, and the day of the year covers from 1 to 366.

The day of the week value depends on your WordPress settings. If you have set the week to start on Monday, that Monday will become 1 until Sunday which will be 7. Otherwise, Sunday equals 1 until Saturday which equals 7.

So, you can not pass a variable (last 2 weeks from today on) in this way, unfortunately

You can pass a Week number, but that is counted as a Week in Year number (1 to 53), which will every year be the same.

I'm afraid you should stick with the "past_one2" filter, or create other Views, or filter by not "dynamic" values in the sense that you pass valid values (number / date of day, week, etc)

Please let me know if you have further questions regarding the issue mentioned in this Thread

Thank you for your patience.

The topic ‘[Closed] Setting filter for postdates’ is closed to new replies.