I have set up a many-to-many relationship (Sports Providers and Camps) with "Camp Appearance" as the intermediate CPT.
It works to some extend but now I'd like to call a field from "Sports Providers" to publish it on the Camp page.
I want to publish the contact details of the sports providers organising the camp. (Often I'll have 2 or more sports providers working on one camp.)
In the intermediary (Camp Appearances), I haven't named any post fields. (Should I do this?)
What do I need to do?
[types field='twitter' target='_blank' id='$camp-appearance'] doesn't work as I haven't named that field and [types field='twitter' target='_blank' id='$sports-provider'] doesn't give any results either.
I'm trying to display the fields of a CPT which are related through another child post.
The relations I have are based on your tutorial on Many-to-Many relations.
"Camp Appearance" (intermediary) is a child to Camp & Sports Provider.
In both parents page, I'm trying to have information about the other parent.
E.g. in the Sports Provider page, I want to have the list of camps for each sports provider and under camps, I need to have the contact details of the Sports Provider.
I tried with a view but doesn't work. (at least how I've done it)
Camp Appearance is purely there to create a relationship (no info in it).
This one may not be possible based on how our many to many relationships work because A child can display its parent information but if you are trying to display information on its sports provider then a view will be needed.
Lets try this.
We create a view to display the children of the current parent "Camp" on that view you will only add this field.
[types field='twitter' target='_blank' id='$sports-provider']
Since the view will be listing out the "Camp Appearances" that are children of the Camp and since the Sports Providers are also parents of the Camp Appearances then this setup should work.
Please try this and let me know if it helps.
Thanks,
Shane
This is what I had done but it returns all the results, this is e.g. all the phone numbers of every sports provider related to a camp - not just the one I'm looking for.
Similar when I want to publish the organisers of a camp, all sports providers who organise " a" camp are published.
In the Post Relationship (from within the Camp page), I selected the 2 camp providers working on a particular camp, but still I get all 4 sports providers (2 on each camp I have created so far) when publishing the view cell.
Do I need to add a query? I couldn't find anything that would work there.
Here's what I done:
Create View Cell in Camp
No query
Filter Editor: didn't do anything to it
Loop Output Editor: as I want to have the names of the sports providers with a link to their page, [wpv-post-link id="$sports-provider"]
Am I doing anything wrong or do you need more info?