Saltar navegación

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

This support ticket is created hace 5 meses, 1 semana. 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
- 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)

Este tema contiene 2 respuestas, tiene 2 mensajes.

Última actualización por Minesh hace 5 meses.

Asistido por: Minesh.

Autor
Mensajes
#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? enlace oculto

#2708398

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: 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

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Can you please check now: enlace oculto

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

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:
- enlace oculto

[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!