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/
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
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?
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.
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.