I am attempting to follow info from https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/displaying-related-child-posts/, https://toolset.com/forums/topic/display-sibling-pages-not-working/, and https://toolset.com/forums/topic/display-other-child-posts-on-child-page-with-many-to-many-relationship/ to display a list of custom post type States sharing a parent custom post type State Group. The relationship, states-in-group, is one State Group to many States.
I have created a view, states-children-of-state-group, displaying States, "Don't include current page in query result" unchecked, and a filter, "Select posts in a States in Group relationship that are a related to the current post in the loop." It's using a very basic loop.
LOOP:
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<ul class="wpv-loop js-wpv-loop">
<wpv-loop>
<li>[wpv-post-body view_template="Loop item in Other States in Same State Group"]</li>
</wpv-loop>
</ul>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
[/wpv-no-items-found]
[wpv-layout-end]
LOOP ITEM TEMPLATE:
[wpv-post-link]
Placing this view by shortcode in an actual State Group post displays the list of child State posts as expected.
Moving forward to set up the content templates to show this view with the context of the State Group parent on the State post, I have template state-group-parent:
[wpv-view name="state-posts-of-current-state-groups-post"]
...as well as template state-child-template:
[wpv-post-featured-image size="medium"]
[wpv-post-title]
<h4>Other states in the same group:</h4>
[wpv-post-body view_template="state-group-parent" item="@states-in-group.parent"]
Using this template on a State post displays the featured image, post title, and "Other states in the same group:" but nothing at all shows up from the view, not even "No items found."
I get the same result with the view filter set to "Select posts in a States in Group relationship that are related to the Post where this View is shown." Also when checking "Don't include current page in query result."
(As as additional stretch, I will want to also show cousin State posts which belong to a State Group which is a sibling to the current State post's parent, (aunt/uncle?), related through the same parent of the two State Group posts, a post type called Sets. I can save this for another ticket if necessary.)
Thanks for helping me wrap my brain around this going up the hierarchy and back down again.