Skip Navigation

[Resolved] Filter a view to show posts published AFTER the post where the view is displayed

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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: Asia/Kolkata (GMT+05:30)

This topic contains 2 replies, has 2 voices.

Last updated by Minesh 1 month, 2 weeks ago.

Assisted by: Minesh.

Author
Posts
#2708331

Tell us what you are trying to do? I have a view that is displaying related posts on the single post page. I want this view to only display posts that were published AFTER the date of the post where the view is displayed.

Is there any documentation that you are following? I looked through the date filters documentation but couldn't find an answer.

Is there a similar example that we can see?

What is the link to your site? hidden link

#2708398

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share admin access details and let me review your current post-relationship and view and then I will be able to guide you in the right direction.

When you say date - you want to target native post publish date or you have custom date field?

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2708980

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

With your view I've change the "Post date" query filter as:
- hidden link

Post date filter
Select posts whose
Published date is after or equal to: year:VIEW_PARAM(year), month:VIEW_PARAM(month), day:VIEW_PARAM(day

I've created the following Toolset content template that will hold your view as given under:
- hidden link

[wpv-view name="video-playlist-related" year="[wpv-post-date format='Y']" month="[wpv-post-date format='m']" day="[wpv-post-date format='d']"]

As you may noticed we are passing the current post year, month and day values as view's shortcode attribute.

And with your cornerstone template, I've added the above content template as:

[wpv-post-body view_template="ct-for-view-container"]

Can you please confirm it works as expected now.

More info:
- https://toolset.com/course-lesson/filtering-custom-lists-of-posts/#value-set-by-view-shortcode-attribute
- https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-post-body

#2709259

This worked perfectly—thank you so much for the help!

joshM-4 confirmed that the issue was resolved on 2024-07-24 19:21:58.
This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.