Tell us what you are trying to do? I am making a website for a medical institute. There are departments and subdivisions. The department has several subdivisions and doctors attached to them.
I need to display a list of doctors attached to each subdivision on the main page of the department.
I have a department in which there are 3 subdivisions (subdivision is the child of department), I made a many-to-manu relation to attached doctors to each subdivision, but I can’t figure out how to use the view to show the doctors attached to my subdivisions on the department page.
Of course, I can make simple blocks with fields on the department page, but I would like to manage / add doctors through the admin control and relay connections and use dynamic content.
Is there any documentation that you are following? I following this case - https://toolset.com/forums/topic/display-posts-in-relationship-with-multiple-parents-childhs/ but not sure how to apply to me.
Is there a similar example that we can see?
Example structure:
Department-1
-----Division-1
----------Doctor-1
----------Doctor-2
-----Division-2
----------Doctor-1
----------Doctor-3
----------Doctor-3
-----Division-3
----------Doctor-1
----------Doctor-2
----------Doctor-3
----------Doctor-4
Department-2
-----Division-1
----------Doctor-1
----------Doctor-3
-----Division-2
----------Doctor-1
----------Doctor-2
----------Doctor-3
Departments that do not have subdivisions display attached doctors perfectly.
Thank you for any help! Or link on documentation were i can see how resolved my problem.
What is the link to your site? hidden link
similiar department without subdivisions - hidden link
Hi,
Thank you for contacting us and I'd be happy to assist.
As there is no built-in feature available to show the related posts in the admin area post list column, this will require code customization.
Here are some guides on adding custom columns into the admin area post lists:
hidden link
hidden link
And to get the related posts from the current post in the list, you can use the "toolset_get_related_posts" function:
https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/#toolset_get_related_posts
I hope this helps and for more personalized assistance around custom code, you can also consider hiring a professional from our list of recommended contractors:
https://toolset.com/contractors/
regards,
Waqar
Thank you Waqar for answer.
Tell me, if I make the department as a new custom post type and make the department-department and department-doctors relay, maybe it will be easier to use it to display the department doctors for each department so as not to use toolset_get_related_posts?
Thanks for the help.
Thanks for writing back.
The "toolset_get_related_posts" function will be needed, whenever you'll need to fetch the related posts for any given post. So even if you'll introduce a new custom post type, you'll still need the "toolset_get_related_posts" function, to get its related posts.