Hey
Reposting a followup question:
We ended up using a many to many relationships i.e a destination has several stories and a story can relate to several destinations. For example, the story "10 grate hotels Israel" can be related to (Destination) Jerusalem and Tel Aviv.
Took (the very useful) steps you describe in your answer, but because the relationship is now many to many, ended up with:
Beach destinations
Cancun| Isla Mujeres
10 beach hotels in Mexico
Good places to eat in Mexico
10 beach hotels in Mexico
The "10 beach hotels in Mexico" is associated with Cancun and Isla Mujeres so it apres twice..
Is there a way to prevent this duplicity?
Thanks!
Doron
The simplest solution is to add the destination taxonomy terms directly to the Stories rather than relying on the taxonomy terms of the parent post. Then you can filter a View of Stories by destination taxonomy term, set by the current archive. If that's not an option, it will require some custom code. There are two approaches:
1. Custom JavaScript that loops over each result and hides any duplicates. A sample script can be found here: https://stackoverflow.com/questions/2822962/jquery-remove-duplicate-elements
Modify that script to suit your site. I can take a look if you run into problems.
2. Change your View of Stories to be filtered by related post ID using a shortcode attribute. Move the View of Stories to be outside the wpv-loop tags of the View of Destination posts. Use your View of Destination posts to output only the post ID of each Destination. Use this View of Destination posts as the value of the related post ID shortcode attribute, following steps described in this post: https://toolset.com/forums/topic/how-use-a-shortcode-instead-of-options-for-cred-forms/
This option has some limitations. Pagination and parametric search should not be used for this View, so you cannot use this View for any purpose other than the one described here.
Already resolved in a different ticket