Support Forum
Support › MB Relationships › Relationships variables?
Maybe my challenge can be easily solved with other methods, but is it possible to have parameters (custom fields) on a relationship instance?
The challenge: two CPT (authors and publications). I'd like to give the authors the ability to handpick a couple of "publications highlights" that will be featured on their personal "frontend Single Page".
The challenge here is that a publication will have several authors, and it may be a "highlight" for some of its authors but not all.
Hence, I imagined that the relationship between an author and a publication would have the "highlight" custom field. Is this possible?
Or would it be better to have a custom field on the user that would allow to search internally for a given publication and insert its ID into that user repeatable custom field?
Thank you for your expertise.
Hi,
I think you can create a custom taxonomy highlight
for each CPT. Using the custom taxonomy will get posts faster than the custom field, please read more here.
Then you can use the setting query_args
when creating the relationship to show the highlight
posts on the select box only.
Get more details on the documentation https://docs.metabox.io/extensions/mb-relationships/#syntax
Hi Long. Thank you for the suggestion. I have a question regarding your suggestion.
Then you can use the setting query_args when creating the relationship to show the highlight posts on the select box only.
This would require first to add the term "highlight" to the publication that the user wants to target (to appear on the select box), and then add the relationship in the user profile, right?
It would also require two relationships between the users and CPT publications right? One that is a "normal" relationship, and another one that is the "highlighted" relationship as you described.
Hope I'm not doing any big confusion here.
Hi,
We need only one relationship between Author and Publication.
highlight
query_args
when creating the relationship to show the publications that have the term highlight
on the select box.