Skip Navigation

[Resolved] Filter view by current post

This support ticket is created 4 years, 10 months ago. 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by sarahK-2 4 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#1513395

I have written a view (of a custom post type) and have it appearing within the single post template of that post type.

I need it to filter by the current post so that it only shows information from that single post (and not the other posts of that type).

Not sure why I can't work it out, but I can't. Thanks in advance!

#1513529

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screenshot 2020-02-17 at 2.42.44 PM.png
Screenshot 2020-02-17 at 2.42.55 PM.png

Hi Sarah,

Thank you for getting in touch.

To resolve this you will need to go to your view and add a Query filter for the Post ID. Then set it to filter by shortcode attribute. See Screenshots.

Then when you add your view to your post with the shortcode you will add it like this.

[wpv-view name='my-view' ids='[wpv-post-id]']

What i'm doing is to pass the current post ID into the view so that it can be filtered.

Please let me know if this helps.
Thanks,
Shane

#1513931

Thanks again! Easy peasy.