Skip Navigation

[Resolved] filter for grandchild

This thread is resolved. Here is a description of the problem and solution.

Problem:
How can I display a Post, that is Grandchild of a given Post.
Grandchild means, it's a Child of a Child of a Parent Post.

Solution:
You just need to create at least 2 Views

1. First View you query by

Select posts that are a children of the current post in the loop

2. Second View you query either by

Select posts that are a children of the current post in the loop.

or by

Select posts that are children of the Post where this View is shown.

(If you want to use this on a single Post)

3. Insert the First View to the Second View's Loop

4. Insert the second View to the Parent Post, or to a 3rd view where you query those parent posts.

The end result is:
- View > Lists certain Posts not child of any
-- View > Lists posts child to the post in the Loop of the above View
--- View > Lists posts child of the post in the Loop of the above View

The Final output is a GrandChild List.

Relevant Documentation:
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

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

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 4 replies, has 2 voices.

Last updated by eliseD-2 7 years, 12 months ago.

Assisted by: Beda.

Author
Posts
#390407

I am setting up a view, and want to set a filter for granchildren of the current post.

When I click to add a filter, it gives me the option of "Post relationship - post is a child of" - but I want to return posts that are a GRANDCHILD of the current post (even if the parent in between might be different for each post).

Can I do that?

Elise

#390507

No, it's not possible to create a Parametric Search by Children of whatever Posts you query in the View.
You can filter by "Post is child of" (which will present a Filter with a list of Parents to choose)

If you need to display Children or Grand Children of a certain post, you can follow this instructions:
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/
https://toolset.com/documentation/user-guides/displaying-fields-grandparents/

The parametric Search can always be "up river", means, you can filter by parent or parent Tree of the Post type you query in the View:
https://toolset.com/documentation/user-guides/front-page-filters/

Please let me know if you need further infos about this.

Thank you for your patience.

#391388

We may be talking about the same thing - but I wasn't talking about a Parametric search.

I was just creating a regular view, and clicking the "Add a filter" option, and using the wizard to choose the parameters for the feature. One of the options is to use "post is a child of" - and I was wondering why there couldn't just as easily be a "post is a grandchild of" option?

Elise

#391727

I apologize, I confused this.

No, it's not available but easy to set up.

You just need to create a new view, where you query by "post is a child of" (the post in the loop) and insert that View to a "parent" view, where you do the same query, and that View again gets inserted to a parent View.

The end result is:
- View > Lists certain Posts not child of any
-- View > Lists posts child to the post in the Loop of the above View
--- View > Lists posts child of the post in the Loop of the above View

The Final output is a GrandChild List.

It's elaborated here:
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

Thank you

#391811

That makes sense.

Thanks!

Elise

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.