Skip Navigation

[Resolved] List post if has children

This support ticket is created 3 years, 8 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/Karachi (GMT+05:00)

Author
Posts
#1724323

Hi Toolset, I need your help again.

So I have parent post named "Company" and has 3 children: Job, Project and Product.
In a page I want to list all companies that only has "Product" post. Is this possible using PHP?

Best Regards

#1725551

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Hi,

Thanks for asking! I'd be happy to help.

If your goal is to show a list of all companies, which have at least one related product post, you can use the same approach as suggested in the other ticket:
https://toolset.com/forums/topic/i-want-to-list-all-parent-posts-that-only-have-children/#post-1725545

You'll just need to make sure that the "$relationship_slug" value in the custom shortcode is set to use the relationship slug for the relationship between "Company" and "Product" post types.

I hope this helps and please let me know if you need any further assistance around this.

regards,
Waqar

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