Home › Forums › General Issues › Loop through post for a "family tree"? › Reply To: Loop through post for a "family tree"?
You need to have bidirectional relationship fields (there are plugins that will do this) or use a reverse relationship query.
The code involve would be quite complex. You would need to create some type of a recursive function to go both up and down the relationships and build arrays with nested arrays holding all of the data and/or display that data. You’d probably also need to use an output buffer, or potentially several output buffers, to build the content.
I can’t give you any example code because it would take many hours to come up with something and I don’t know of any examples of doing something like this.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.