Skip Navigation

[Closed] Display child post of 2nd level

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

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)

This topic contains 14 replies, has 2 voices.

Last updated by Shane 2 years, 2 months ago.

Assisted by: Shane.

Author
Posts
#2447993

Need display child post of 2nd level:

Post type 1 link with Post type 2 child post.
Post type 2 link with Post type 3 child post.

is it possible to show respective Post type 3 on a page Post type 1 ?

Sincerely
Anton

#2448027

Shane
Supporter

Languages: English (English )

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

Hi Anton,

Thank you for getting in touch.

It is actually possible to display the grandchild on the Grandparent post.

However for this to be done you will need to create a nested view setup where you'll have the Parent View and the Child view.

Where the Child View is nested inside the Parent view and then the Parent view is added to the Grandparent post template.

Are you aware of how to do the nesting of views to get the correct post relationship information ? Also this requires the use of the classic view setup.

Please let me know so that I can provide additional information for you to get this done.

Thanks,
Shane

#2448037

Need additional information how to do this. Appreciate.

Thank you in advance!
Anton

#2448059

Shane
Supporter

Languages: English (English )

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

Hi Anton,

As mentioned this will require the classic view setup.
If the classic view hasn't been enabled you can enable it by going to Toolset -> Settings and scrolling to Editing Experience. From there I recommend that you select " Show both the legacy and Blocks interface and let me choose which to use for each item I build".

This will allow you to have access to the classic editor as well as the block editor. From there refresh the page and go to Toolset -> Views.

First you will need to create your Grandchild view by going to Toolset -> Views and clicking Add New view, select your grandchild post type and under the query filter section you will add the Post Relationship filter, then select "The current post in the loop"

From there you can go to the Loop Wizard section and using this button add the data that you want the view to display.

Secondly you will need to create the Parent View. Repeat the step above to create your Parent view and then for the Post Relationship filter select "The post where this View is shown"

Now under the loop editor section you will add your grandchild view's shortcode within the <wpv-loop></wpv-loop> shortcode.

Here is an example


<wpv-loop> [wpv-view name='my-slug']</wpv-loop>

Where "my-slug" is the slug of my grandchild view.

Finally just add your Parent view to the Grandparent post template.

Please let me know if this is clear.

Thanks,
Shane

#2448495

Excellent!! It works! Thank you a TON!

Just one moment. Posts are ordered by date but listed by each grandchild. First all posts of one grandchild, then all posts of second , etc. Is is possible to order posts by date among all grandchild posts?

Sincerely
Anton

#2448715

Shane
Supporter

Languages: English (English )

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

Hi Anton,

Unfortunately not. If I understand correctly your posts are ordered by their dates based on the current parent that is being used to display the post.

Example: this is how it is currently being displayed

Parent A
Child B
Child D
Parent B
Child A
Child C

THis is how you want to to be displayed
Child A
Child B
Child C
Child D

Unfortunately you won't be able to do it like this given that the grandchild's view is dependent on the parent view, so it is being sorted relative to the parent being displayed.

Thanks,
Shane

#2449183

got it. Thank you!

Just one question related this construction:

is it possible to make View to display GrandParent posts only for those users who are authors of grandchild/parent posts?

Thank you in advance!
Anton

#2449507

Shane
Supporter

Languages: English (English )

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

Hi Anton,

It is possible, you will just need to add the Post Author query filter to the Parent and grandchild view.

Thanks,
Shane

#2449869

Shane, when I add filters in parent and child posts it influence on display inside. I see only authors posts.

But it's required to display Grand parent posts who those who are a part of parent and child. While parent and child posts should contain all posts of all respective users.

Please advise whether this questions can be solved as part of current topic or need to raise new one.

Thank you
Anton

#2451071

Shane
Supporter

Languages: English (English )

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

Hi Anton,

If I understand correctly only the Grandparent should be listed based on the current user ? All the others Parent/Child should be dependent on the grandparent correct?

We can continue in this thread since it is essentially the same issue.

Please let me know.
Thanks,
Shane

#2451151

Thank you!

yes. The list contains only grandparent.

Grandparent - author 1
Parent and child - author 2, author 3

Grandparent should be visible for authors 2 and 3.

Entering grandparent users see parent and child posts.
Authors 2 and 3 should see all posts of all authors under grandparent.

Sincerely
Anton

#2451219

Shane
Supporter

Languages: English (English )

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

Hi Anton,

Still a little unsure of what is required because without the Author filter on both views it should display all the posts belonging to the grandparent by default.

Perhaps you can provide me with access to the site to see what is being listed?

Thanks,
Shane

#2451693

Shane
Supporter

Languages: English (English )

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

Hi Anton,

My assumption here was that you were listing the children on the grandparent's frontend page.
The content template here hidden link

It's not assigned to any post type.

Is it that you're creating a page listing the grandparents but you only want the grandparent post that the current user creates and then under that grandparent you want to list all the other posts in the relationship regardless of the author ?

Thanks,
Shane

#2453171

correct: creating a page listing the grandparents

not exactly: you only want the grandparent post that the current user creates
comments: grandparent should be visible for user which created it AND FOR USERS CREATED CHILD POSTS. And all posts in the relationship should be visible for all such users.

correct: under that grandparent you want to list all the other posts in the relationship regardless of the author

#2453265

Shane
Supporter

Languages: English (English )

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

Hi Anton,

Can you setup the page on the frontend so that I can have a look at how you're doing it.

I'm still not sure how the post author filter would come into play with this.

Thanks,
Shane

The topic ‘[Closed] Display child post of 2nd level’ is closed to new replies.