Hi-I’m new here and more of an analyst/PM than developer. Forgive me for the terms I use.
My site uses CPTs where each post resides in a level within a tree. This is the tree:
An existing relationship field is used to associate child elements with a parent. For example I can create a US History curricula and create 5 Units. I then assign the Units to the curricula using a relationship field at the curricula level.
The pattern repeats the next level down. I might create 3 lessons. I edit the unit and select the three lessons. Same with the next level down, which is activity.
Here is the twist: a lesson or activity may have more than one parent. In order to show a breadcrumb trail on the UI we want each node (post) on the tree to have one “preferred” parent. For example if a user finds lesson randomly, we want to present the preferred unit it belongs to and preferred curriculum the unit belongs to.
In most cases each activity, lesson, and unit have only one parent. I’m not sure if that is relevant. We could possibly make it a rule that each have only one parent if that helps but I would prefer not to.
For now, we have implemented a second repeater field that looks up the tree rather than down. Each activity, lesson, and unit has a parent with one and only one lesson, unit or curriculum selected respectively. That gets us a single tree we need for the breadcrumb.
I’m concerned about managing the links both up and down the tree. It seems very redundant. Is this the most efficient way to mode this?
I can imagine a relationship field where one of the many values being selected can be flagged as special. That would do it I think but I do not know if this field type exists.
Viewing 1 post (of 1 total)
You must be logged in to reply to this topic.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users