Skip Navigation

[Closed] Nested views that query relationship not post type

This support ticket is created 3 years, 7 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

Tagged: 

This topic contains 8 replies, has 2 voices.

Last updated by Shane 3 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#1756271

I refer to a previous support thread which I was unfortunately unable to complete before it expired: https://toolset.com/forums/topic/nested-views-that-query-relationship-not-post-type/

This thread follows that support thread:

I have created a test page: hidden link

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.

#1756635

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ian,

Thank you for getting in touch.

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.

Thanks,
Shane

#1756851

Hi Shane - sorry it's a bit confusing...

The first view works 100% except that it can't sort the posts by the order they should appear. So I've used this approach: https://toolset.com/forums/topic/ordering-posts-in-a-relationship-with-another-post/

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?

#1756853

To be 100% clear - I want the output to look exactly like the first view, but be in the correct order, according to the assigned order field.

#1756877

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ian,

Perhaps if I had access to the view itself I can have a look at the view to see it's setup to have a better understanding.

I've enabled the private fields so that you can provide me with the credentials.

Thanks,
Shane

#1756997

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ian,

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.

Thanks,
Shane

#1758097

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.

#1758103

OK I've found what you added and removed it. Please create copies of views or other content to test, because this is a live production site.

#1758183

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Ian,

Thank you, also you didn't confirm here.
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.
From my post below.
https://toolset.com/forums/topic/nested-views-that-query-relationship-not-post-type-2/#post-1756997

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.