I would like to generate a slider or a view in order to show posts that occured exactly one year ago, or 50 years ago to the exact date like today.
Let's say today is July 1. 2021
I would like to show posts from July 1. 2020
and lets say posts from July 1. 1990 or July 1. 1970.
We have lots of old pictures and it would be nice to have a feature like in google photos, where you see images/posts that were in the past, but exactly this to the current day.
I was looking at your documentation here:
https://toolset.com/documentation/user-guides/views/filtering-views-query-by-date/
Hello,
There isn't such kind of built-in feature within Toolset plugins, but you can try the workaround mentioned in below thread:
https://toolset.com/forums/topic/how-to-add-month-and-year-dropdown-filters-for-an-archive-search/#post-1236133
Hello Lou,
sorry but this isn't what I was looking for. I do not need a dropdown with certain dates or years.
What I need is the exact date of the current day back in time - x years ago, showing me the posts.
You can setup the Post date filter in view's query, like this:
Select posts whose
Published date is after: year:VIEW_PARAM(year), month:VIEW_PARAM(month)
See my screenshot date-filter2.JPG
And display above view's shortcode with "year" and "month" attributes, for example:
[wpv-view name="your-view-slug" year="2020" month="6"]
With your setup I can select a SPECIFIC date in time and dispay the posts befor or after etc.
But what I need is a way to tell the system to calculate this date to be lets say 40 years from TODAY (for every day, so tomorrow it will be July 2nd , then July 3rd etc.) but 40 years ago.
For the new question, it needs custom codes, for example, you can try these:
1) Add below codes into your theme file "functions.php":
add_shortcode('time-ago', function ($atts = [], $content = null) {
return human_time_diff( wpv_do_shortcode($content) );
});
2) Use above shortcode like this:
[time-ago][wpv-post-date format="U"][/time-ago]
More help:
https://developer.wordpress.org/reference/functions/human_time_diff/
It seems I cannot see your last reply here in the ticket. (I copied your reply below)
I only see an excerpt sent via email.
Sorry I am no programmer, how would I use the function in order to display e.g. posts that are one year ago on this exact day?
with this shortcode?
[time-ago][wpv-post-date format="U"][/time-ago]
For the new question, it needs custom codes, for example, you can try these:
1) Add below codes into your theme file "functions.php":
add_shortcode('time-ago', function ($atts = [], $content = null) {
return human_time_diff( wpv_do_shortcode($content) );
});
2) Use above shortcode like this:
[time-ago][wpv-post-date format="U"][/time-ago]
More help:
https://developer.wordpress.org/reference/functions/human_time_diff/
Please provide a test site with the same problem, fill below private message box with your website credentials, also point out the problem page URLs and view URL, I can setup a demo for you.
Thank you I found what I needed - it's working.
My issue is resolved now. Thank you!