How can I check if a Post in a Views Loop has Children?
You can use the Types API for this.
A great Custom ShortCode example is documented here:
https://toolset.com/documentation/user-guides/many-to-many-post-relationship/ > Displaying Many-to-Many Relationship Using Types PHP API
Look for the code "Below, there is an example on how to create a shortCode that returns all children posts IDs, which is useful to check if a post has child posts, inside a Views Loop."
Also in the above DOC, it's elaborated how you use this in a HTML conditional.
Here is a more detailed version, which also checks for the Current Logged in user is the author of that Child Post or not:
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.
|-||-||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)