Skip Navigation

[Resolved] Show relation elements for each child posts in main post

This support ticket is created 2 years, 1 month ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 3 replies, has 2 voices.

Last updated by Waqar 2 years, 1 month ago.

Assisted by: Waqar.

Author
Posts
#2279431
Untitled-2.jpg
Untitled-1.jpg

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

#2279763

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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

#2279965

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.

#2280651

Waqar
Supporter

Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

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.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.