Skip Navigation

[Resolved] Table Display Toggle for Posts with and without children

This support ticket is created 7 years, 6 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 1 reply, has 2 voices.

Last updated by Luo Yang 7 years, 6 months ago.

Assisted by: Luo Yang.

Author
Posts
#523227

J S

I would like to know how to create an alternative version of the table on this page

hidden link

that can be toggled on/off OR shown on another page to display all institutions (parents) or only those with at least 1 policy (child). This way if the table has 5,000+ institutions (parents) they can be viewed as shown currently, but as most of them will not have policies (children) initially, a shortened display of the table could be viewed showing only those with policies posted.

Thanks!

#523343

Dear JS,

I assume we area talking about this case:
Patent post type "institutions"
-- Child post type "policies".
You are going to setup a view, list "institutions" posts, display "institutions" posts if there is child "policies" posts.

There isn't such a built in feature within Views, as a workaround, you can create a nested view:
1) Parent view display "institutions" posts, and display below child view
2) Child view display "policies" posts,
a) filter by:
Post relationship filter
Select posts that are a children of the current post in the loop.
https://toolset.com/documentation/user-guides/querying-and-displaying-child-posts/
b) if there is any result, display the parent "institutions" information:
https://toolset.com/documentation/user-guides/displaying-fields-of-parent-pages/