Skip Navigation

[Resolved] Can't display a view with similar posts based on relationship

This support ticket is created 3 years, 8 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by William 3 years, 8 months ago.

Assisted by: Waqar.

Author
Posts
#2036201
Screen Shot 2021-04-28 at 7.00.42 PM.png

Tell us what you are trying to do?

I have two post types and a relationship between them

post type 1: "watershed"
post type 2: "place"
relationship: one to many (watershed is the one, places are many): "watersheds-places"

I want to create a view on a place page that show other places in the same watershed

I have done the following:
created a view with slug "similar-places-small"
I am querying "places"
I have set the view to filter on post relationship watershed-place related to the Post with ID set by the shortcode attribute: wpvrelatedto

I took the shortcode from the below link and modified it to:
[wpv-view name='similar-places-small' wpvrelatedto="[wpv-post-id item='@watershed-place.parent']"]

...with no success. The view displays places that do not share the relationship. I am hoping I have the shortcode wrong.

Is there any documentation that you are following?
https://toolset.com/forums/topic/displaying-related-posts-2/

#2036631

Hi,

Thank you for contacting us and I'd be happy to assist.

The steps that you've shared seem to be correct, however, I see some difference in the post-relationship slug.

In the introduction, you've used it as 'watersheds-places', but in the view's shortcode, it is 'watershed-place'.

Can you please make sure that the correct relationship slug is being used and you get the parent post's ID correctly when you use the post ID shortcode alone?
( i.e. [wpv-post-id item='@watersheds-places.parent'] or [wpv-post-id item='@watershed-place.parent'] )

I hope this helps and please let me know how it goes.

regards,
Waqar

#2037173

Thanks Waqar,

I caught that same mismatch about 10 seconds after submitting my ticket and corrected it thinking that it would fix the issue.. Unfortunately it didn't change anything.

Any other ideas?

#2037415

Thanks for writing back.

Can you please share temporary admin login details, so that I can see how this view is set up in the admin area?

Please also include a link to an example single "places" page, where this view can be seen.

Note: Your next reply will be private and please make a complete backup copy, before sharing the access details.

#2042419

After rewriting the shortcode from scratch in a text editor and pasting it back in, it worked. Perhaps it was a character issue with the quotation marks? Thanks for your help. It is working now.