Skip Navigation

[Resolved] Display alphabetical list of grandchildren

This thread is resolved. Here is a description of the problem and solution.

Problem:

I would like to display all the schools that are grandchildren of that province, in an alphabetical list.

Solution:

The client resolved it by using custom shortcodes.

Relevant Documentation:

This support ticket is created 4 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/Hong_Kong (GMT+08:00)

This topic contains 2 replies, has 2 voices.

Last updated by amandaD 4 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1852967

Consider the relationship:
- Province
-- City
--- School

In the template for a single Province, I would like to display all the schools that are grandchildren of that province, in an alphabetical list. I have found documentation for displaying grandparent fields in the grandchild post (eg, I can display the Province in the single School view), but I need to do this the other way around now? Or more specifically, how do I alphabetise the grandchildren - because currently they are alphabetised by city, and THEN by school name

#1853057

Hello,

This is expected result, since there isn't direct relationship between "Province" and "School", so Views won't be able to query related "School" posts in a single "Province" post.

As a workaround, you can setup another one-to-many relationship between "Province" and "School", edit each "Province" post, and connect with other "School" posts, then you will be able to query related "School" posts in a single "Province" post, and order the result by school name.

More help:
https://toolset.com/course-lesson/displaying-related-posts/#displaying-many-related-items

#1853339

Thanks, I will write a PHP shortcode to do this instead. Thanks.