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 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
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/
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.
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.
This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.