Skip Navigation

[Resolved] filter taxonomy view with term from another taxonomy

This support ticket is created 2 years, 8 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 10 replies, has 2 voices.

Last updated by peterT-9 2 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#2323007
SS_000103.jpg

Tell us what you are trying to do?
I have a taxononmy 'projectyear' that list and counts all the projects I have like this:

2022 (2)
2021(12)
2020 (10)
etc.

I would now like to filter the results with another taxonomy 'projectstatus' so that the above mentioned list only contains the projects that have projectstatus = 'confirmed'

so the result would look like this (example) :

2022 (1)
2021 (10)
2020 (10)

I use a shortcod to display the taxonomy list and I understand that I can filter with terms but I cannot make it work

[wpv-view name="projects-by-year" terms="??"]

[wpv-view name="confirmed-projects"]

What is the correct code for this

Thanks

Peter

#2323341

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Peter,

Thank you for getting in touch.
I use a shortcod to display the taxonomy list and I understand that I can filter with terms but I cannot make it work

When you say filter it by terms are you referring to filter Taxonomy A by the terms of Taxonomy B ?

This is what I understand from the wording of your issue. However this isn't possible to do, you can filter Taxonomy A by Taxonomy B because Taxonomy A and B are not linked.

Thanks,
Shane

#2323373

Hi Shane, ok I get this. In that case I would pull all the records That have Taxonomy A (projectyear) and Term "confirmed" of Taxonomy B (projectstatus). I only oputput the Taxonomy A . This would look like this

2022
2022
2021
2021
2021
.......

How can I group the output to only show each year once like

2022
2021
....

This would also deliver the desired result, I have found a lot of results with Google but all the answers werw archived already 🙁

Thank you for your support

#2323409

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Peter,

Not sure if i'm understanding clearly. This list below.
2022
2022
2021
2021
2021

This is the Taxonomy A terms? Or are they posts from Taxonomy A. I'm assuming here that your view is a Taxonomy view and Not a Post view.

Once I understand this maybe I can see it a little clearer.

Thanks,
Shane

#2323691
SS_000105.jpg
SS_000104.jpg

Hi Shane, sorry if I was not clear. It is a Post view filtered by Taxonomy B (projectstatus = "Genehmigt) showing only the field Taxonomy A (projectyear) . Sinc I have several Projects (posts) per year the output produces a list like thiss

2022 (post1)
2022 (post2)
2021 (post3)
2021 (post4)
2021 (post5)
.......

I would now like to group this output as i would do in SQL with the Group by command so that each year is only shown once and I can link it to the respective archive page.
If I use a taxonomy view I get all posts with Taxonomy A which is not what I want . they have to be filtered by Taxonomy B.

Thanks for your help, I hope this is more clear now, I am really stuck here

Peter

#2324077

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Peter,

I understand a little better now and believe I may have a solution here. However would you mind allowing me to have admin access to the site so that I can assist better. Looking at what you currently have and your output will allow me to get an idea of the full picture.

Please also send a link to the view you are using as well as the frontend page that you are listing out the display.

Thanks,
Shane

#2324275

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Peter,

Ok so I believe I have a bit more context now on the issue. Basically you want to list out the taxonomies
2022
2021
2020

However if you're to list it without filtering the posts you will get only
2022 (2)
2021(12)
2020 (10)

Basically you want in the numbers count you only want posts that have a specific taxonomy value in Taxonomy B to be included in the count which would result in this below.
2022 (1)
2021 (10)
2020 (10)

Essentially this below gives you want you want.
hidden link

Please let me know if this helps. I managed to use the nested views below to achieve the goal.
hidden link

hidden link

Thanks,
Shane

#2324687

Hi Shane,

wow this is aweseome. Ho can I hide entries with (0) ? I tried

[wpv-conditional if="( '[wpv-view name=\'project-child-view\']' gt '0' )"]
[wpv-taxonomy-title]([wpv-view name="project-child-view"])
[/wpv-conditional]

#2325081

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Peter,

Unfortunately no you won't be able to do this. This is because our conditionals won't work when you're passing a view into it.

This is due to the formatting that the view renders with that will cause the conditional statement to break.

Thanks,
Shane

#2325083

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Peter,

Unfortunately no you won't be able to do this. This is because our conditionals won't work when you're passing a view into it.

This is due to the formatting that the view renders with that will cause the conditional statement to break.

Thanks,
Shane

#2327927

My issue is resolved now. Thank you!