Skip Navigation

[Resolved] Displaying Related posts

This support ticket is created 4 years, 9 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 Steve Alvarez 4 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#1490207

I'm having trouble displaying related post content.

I've setup two custom post types with a many to many relationship. There is also an intermediary post type connecting them. They are setup as follows.

Audio Books (custom post) << Series Number (intermediary) >> Book Series (custom post)

On the Audio Books post page, I'd like to display a section titled "Other Books in this Series" - so, other Audio Books posts that are related to the current Audio Book because they are in the same series.

I'm currently using Toolset Types and Views to display content and can't determine the correct settings to display the content as described above. Please advise!

#1490989

Shane
Supporter

Languages: English (English )

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

Hi Steve,

Thank you for getting in touch.

This could get quite trick but it is possible. What you need to do is to create a view for the brothers posts that will list out the same post type.

Next add a query filter to your view for the Post Relationship and then set the post relationship filter to filter by a shortcode attribute.

Setup your view to how you want the related children to be displayed, then add this view to the template of the current post you are viewing.

You will need to add the view as a shortcode like this.


[wpv-view name='my-related-post' wpvrelatedto="[wpv-post-id item='@slug-of-the-relationship.parent']"]

Now you see the "wpvrelatedto" shortcode parameter and this is the parameter that we set in the relationship filter of the view. Next you see I've used "[wpv-post-id item='@slug-of-the-relationship.parent']", this is to get the ID of the parent post of the current post and pass it into the view to filter for the other posts with the same parent. Replace "slug-of-the-relationship" with the actual slug of the post relationship.

Please let me know if this helps.

Thanks,
Shane

#1492857

My issue is resolved now. Thank you!