This shows two embedded views - the first view shows the correct results. However, the posts are not in the correct order.
Therefore I have created a second view, this time querying the relationship not the post type, and ordering the results by the a relationship field. In this view the posts are in the correct order, but now the problem is that the second embedded view showing the authors doesn't work.
NOTE - In both views above, I have artificially set the query filter to a specific post for the purposes of troubleshooting. In the live site the query filter will use a shortcode to dynamically select posts.
I would be more than happy to assist you with this one.
This is what I understand from your thread so far.
A. You've created a Parent view to display some post information however the view isn't being sorted correctly.
B. You then created a second view and added it into the First view and add a query filter for the Post Relationship.
What I'm confused about is this " In this view the posts are in the correct order, but now the problem is that the second embedded view showing the authors doesn't work."
So you're saying that your first view is working fine but now the second view doesn't show any results? You mentioned that you sorted the second view by a relationship field. Is this field on the Post Type that your view is trying to sort it by ?
Please clarify a bit for me and if you can send a screenshot of the view that doesn't work as well as the field on the post type that you are trying to sort by.
Hence to show the posts I query the relationship (with a numerical sort order field) rather than the child post type. As can be seen in the second view - this works, and the posts now appear in the correct order.
My problem is that the first view uses an embedded view to query related posts (Authors) of the child post and show the authors of the articles. In the second view this doesn't work, because the I am trying to query the relationship not the parent post within the loop.
Is there a way around this - i.e. some kind of nested relationship logic?
Thanks I think i'm a little clearer on the problem now.
You child view should be displaying the post author of the People post, right now your child view "AUTHORS All no link" is set to display the post Title of the related People Post.
Can you confirm that this is my assumption. Still a little unclear about a few things and wouldn't want to provide the wrong advise on how to resolve this.
Hi Shane - have you changed anything in the "AUTHORS All no link" view? I'm getting some very strange results in the front end and that view is used elsewhere in the site.
I see where your views are both setup correctly and are listing out the information . However i'm not clear on what you want to list out in the child view because right now its listing the post title of the People custom post type.
So if we take an approach where you let me know what the child view should display we can take it from there. It helps to avoid ambiguity and confusion.
For e.g you say "I want my child view to display xyz from my child post type and sorted by x field".
Please let me know and we can take it from that angle to see if we can come to a resolution quicker.
Thanks,
Shane
The topic ‘[Closed] Nested views that query relationship not post type’ is closed to new replies.