Skip Navigation

[Resolved] Parent/child taxonomy Views (Language > Proficiency Level)

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

Problem:
Parent/child taxonomy Views (Language > Proficiency Level)

Solution:
You need to use the nested views to display the related parent and child taxonomy terms.

You can find the proposed solution in this case with the following reply:
=> https://toolset.com/forums/topic/parent-child-taxonomy-views-language-proficiency-level/#post-1352195

Relevant Documentation:
=> https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/

This support ticket is created 5 years, 4 months 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 8 replies, has 2 voices.

Last updated by simonM-5 5 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#1351623

Tell us what you are trying to do?
I am struggling to get parent/child taxonomy Views working. Here is a simplified example of structure of the parent/child hierarchy of Languages and their Levels I'm trying to achieve:
Title / slug
German / german
-- Native / 1-german-native
-- Fluent / 2-german-fluent
-- Intermediate / 3-german-intermediate
-- Basic / 4-german-basic
English / english
-- Native / 1-english-native
-- Fluent / 2-english-fluent
-- Intermediate / 3-english-intermediate
-- Basic / 4-english-basic

I understand that it is possible to create a View pulling only all the parent terms from the database. I believe I have this working. I created a View, "Languages View" and set the filter to "Select taxonomy terms whose parent is None". So far so good. 😉

My problem is getting my child list (ie the language levels). I created a second View, "Language Levels View" and set my child view to "Select taxonomy terms whose parent is set by the parent view", I'm still retrieving parent and child terms on the front end, where I would only expect to see for example "Native", "Fluent" items being returned from the database etc.

Is there any documentation that you are following?
https://toolset.com/documentation/user-guides/using-a-child-view-in-a-taxonomy-view-layout/#taxonomy-view-within-taxonomy-view

Is there a similar example that we can see?
https://toolset.com/?page_id=3775 (your ToolSet Directory Reference site)

What is the link to your site?
hidden link

#1351651

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

After reviewing the description you shared it almost look like you are just doing right things and it should display the related child terms with child view.

I need to check on your install whats going wrong there. Can you please share problem URL and wp-admin access details as well as what views you created.

*** Please make a FULL BACKUP of your database and website.***
I have set the next reply to private which means only you and I have access to it.

#1351665

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

For now, wp-admin access details would be fine.

I have set the next reply to private which means only you and I have access to it.

#1351695

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

I've deleted the child view you added to the content template:
=> hidden link

Then, I've added the child view to parent view's "Template for this view" section:
=> hidden link

You can now format the loop output to adjust the look for your child view as per your requirement.

#1351723

Hi Minesh

1) That looks better, however I am still technically unsure how the child View "Languages Level View" is filtering its results to parent View "Languages View". How does the child View "Languages Level View" know which View is its parent?

2) Also, I had to add the filter "Taxonomy is set by the current post" to the parent View "Languages View", so that only the languages for each Nanny are shown. Is that correct the correct way to do it? I think this is OK for the "Languages View" and "Language Levels View", since these are pulled into the Content Template "Template for Native Nannies".

3) Finally, I would like to also add these two fields as Search Controls in the left panel ("Native Nanny Search Controls View"), so that the first checkbox selection only shows the available languages, and the second control, a dropdown select box allows the user to pick a level per language.

How would you recommend to achieve this?

As you can see on the left hand side hidden link all the parents and children are still being pulled in if I pull in the language taxonomy...

Thanks and best regards
Simon

#1352195

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

1) That looks better, however I am still technically unsure how the child View "Languages Level View" is filtering its results to parent View "Languages View". How does the child View "Languages Level View" know which View is its parent?
===>
As you added the child view to parent view's loop output editor's content template (view's template) - that is why we know that we added X view (child) to Y view (parent)

2) Also, I had to add the filter "Taxonomy is set by the current post" to the parent View "Languages View", so that only the languages for each Nanny are shown. Is that correct the correct way to do it? I think this is OK for the "Languages View" and "Language Levels View", since these are pulled into the Content Template "Template for Native Nannies".
===>
Yes, thats correct.

3) Finally, I would like to also add these two fields as Search Controls in the left panel ("Native Nanny Search Controls View"), so that the first checkbox selection only shows the available languages, and the second control, a dropdown select box allows the user to pick a level per language.
===>
Do you mean you want to control what's displayed with your taxonomy filters - dropdown, having said that you want to display only options that are available as results? If yes:

Can you please check now: hidden link

I've changed the custom search settings to display filters for available options for each input as you can see with the following screenshot: hidden link

#1355661

Hi Minesh

Thanks for the updates and apologies for the delay in getting back to you.. We have decided that we don't want to go for Language > Proficiency hierarchy because it is too complicated for users to understand.

Instead we would just like to use the list of languages twice, ie once as a list of possible "Native Languages" and once as "Other Languages Spoken". The list of languages would be the same in both cases.

In SQL I know this is an alias of the same physical table, but how is the best way to achieve this in Toolset/Wordpress?

Do we simply create two separate Views and reference the taxonomy twice or do we need to create two separate taxonomies, eg "Native Languages" and "Other Languages Spoken"?

Thanks for letting us know the best technical way to achieve this!

Best regards
Simon

#1355679

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Do we simply create two separate Views and reference the taxonomy twice or do we need to create two separate taxonomies, eg "Native Languages" and "Other Languages Spoken"?
===>
Yes - you should create two separate taxonomies Native Languages" and "Other Languages Spoken" and two views to display it.

#1355851

My issue is resolved now. Thank you!