Problem: I would like to create a list of posts that are related to the current post. The posts are all in the same post type.
Solution: In the current system, the best way to do this is to use a custom taxonomy that includes terms that match the slugs of each post. For example, you have Post A and Post B that should be related to each other. So you create terms "post-a" and "post-b" in a custom taxonomy. Then you add the term "post-b" to Post A, and you add the term "post-a" to Post B.
Then create a View of this post type, filtered by taxonomy term slug, where the slug is set by a shortcode attribute "wpv-related-posts". In the Loop Output of this View, insert a post link with the wpv-post-link shortcode.
Pass the current page's slug into this shortcode attribute using the wpv-post-slug shortcode, like this:
[wpv-view name="your-view-slug" wpv-related-posts="[wpv-post-slug id='$current_page']"]
Relevant Documentation:
https://toolset.com/documentation/user-guides/passing-arguments-to-views/
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-slug
https://toolset.com/documentation/user-guides/create-custom-taxonomies/
Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 1 reply, has 2 voices.
Last updated by 6 years, 9 months ago.
Assisted by: Christian Cox.
The forum ‘Types Community Support’ is closed to new topics and replies.