I’ve already created a ticket for this request but maybe I should have asked the community firts.
What I’d like to do is – do a loop through all posts for specific acf values and list them on one page. Background story is a family tree. Each members gets a post, all values are added to these posts. It would now be fantastic to have a function that shows on one page:
– the parents of an entry and maybe 2-3 generation before that
– the kids of an entry and maybe also 2-3 generation before that
And the list should show:
– full names
It would be fantastic if someone finds the time and the mood to maybe provide me with some explanation or an example code snippet.
Did you manage to get this solved? We are after a similar thing
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.