Skip Navigation

[Resolved] Taxonomy Custom Search

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

Problem:
Can we add Custom Searches to Taxonomy Views, as we can do it in Post Views?

Solution:
You cannot have Taxonomy Custom Searches with Toolset.
This feature can be used only in a Post view.

We have an accepted feature request filed for this, hence this will be implemented sooner or later.

100% of people find this useful.

This support ticket is created 6 years, 10 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
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 6 replies, has 2 voices.

Last updated by LisaF3065 6 years, 10 months ago.

Assisted by: Beda.

Author
Posts
#616883

Tell us what you are trying to do?
I have two taxonomies:

a. Main Topics taxonomy

b. Sub Topic taxonomy

I am attempting to have the sub topic taxonomy listed on what has been selected in the main topics taxonomy

Is there any documentation that you are following?

tried many examples all failed

Is there a similar example that we can see?

Have not found any

#616974

Can you explain where and how this should be displayed?

Is this happening in a View, with a Custom Search, or are we talking about WordPress Archives, or even single Posts?

This will be crucial to find the solution.

Are those taxonomies 2 different ones, or is it one and the same, with a hierarchical structure whereas you have parent and child terms?

If the taxonomies are 2 different ones, there is no possibility to somehow display them stacked in a certain related order, as there would be no relation.
If they are hierarchical, you can as example display the Terms, by hierarchy, ordered asc or desc, using this ShortCode:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-taxonomy

In a custom search a taxonomy can be shown with https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-control-post-taxonomy instead.

Both can be ordered, but both cannot relate to another, not connected Taxonomy.

Please let me know the exact circumstances of your goal.

#617165

This is in a view.

It is two separate taxonomies, both different. They both are assigned to one CPT. However, I'd like the following functionality to work....

Taxonomy 1
Option A
Option B
Option C

Taxonomy 2
Option 1
Option 2
Option 3

Then when I am assigning the taxonomies to a CPT, it will be assigned one or more in each Taxonomy. I am NOT using hierarchical with parent and child.

Example:
Post 1 will have Option A, B, 3 checked.
Post 2 will have Option A, 1, 3 checked.
Post 3 will have Option B, C, 2, 3, checked.
Post 4 will have Option C, 1 checked

I have the search set up to go by taxonomy 2, I'd like for it to look at Taxonomy 1 and list all taxonomy 2 that has taxonomy 1 enabled.

So the resulting list would end up something like this:

Option A - Option 1 (count 1), Option 3 (count 2)
Option B - Option 2 (count 1), Option 3 (count 2)
Option C - Option 1 (count 1), Option 2 (count 1), Option 3 (count 1)

Using a hierarchical with parent and child taxonomy will not work because there will be many overlaps in the child taxonomy.

#617841

What you could do is apply a Query Filter for taxonomy 1, since this filter will never be manipulated by the end user, but always should check for posts that have at least some terms of taxonomy one assigned.

Then, add a Custom Filter for the taxonomy 2, where the user can choose and search by terms.

This will in any case only show posts that have:
- the settings as applied by the end user in the custom search
- the parameters used by you in the Query Filters.

The Query Filter should look like:

Select posts with taxonomy:
"Your Taxonomy" in one of these: your-term-one, your-term-two

Of you cannot foresee all Terms that will be applied in taxonomy 1, you cannot use a Query Filter, because in a Query Filter you will have to pass the exact terms to check for (you cannot check if "it's empty)

But, you can instead of a Query Filter use a Conditional HTML where you merely hide all posts which are not having a Taxonomy 1 term assigned:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/displaying-taxonomies-conditionally/#one

This, together with the Custom Search for Taxonomy 2, should allow you to do what you described above.

#618046

Thank you but this does not work because this is showing the posts. I want to show the taxonomy 2 as a list under taxonomy 1.

#618276

You cannot have Taxonomy Custom Searches.

Hence this can be used only in a Post view.

You can thou list your taxonomy terms, instead of Post Title, as an example.

But to have a search, you need to query posts in the View

In the archives, you can have a search for a Taxonomy Archive, but actually, that is a post loop as well.

Unfortunately you cannot have Taxonomy Views with Custom Searches, but there are feature requests filed - which I upvoted for you.

#618416

Thank you