Skip Navigation

[Resolved] dropdown filter for taxonomies

This support ticket is created 5 years 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by davidP-26 4 years, 12 months ago.

Assisted by: Nigel.

Author
Posts
#1516137
Screenshot 2020-02-19 at 11.07.19.png

Tell us what you are trying to do?
I have a "Products" post type with two taxonomies: Product groups and Applications. Applications taxonomy will have 5 parrent entries and many subentrie (children of main taxonomy), example Label Papers (Dairy, Confet, Pet food, Gift paper, Flour sugar ...).

What I need to acomplish is a 5 Toolset views on 5 different Application subpages.
For example for Label Papers Application I need a view with Dropdown that displays children of Label Papers (Dairy, Confet, Pet food, Gift paper, Flour sugar ...) and below products with photo, product name and link will appear.

The problem is that I can't display dropdown with taxonomies, only post types.

Is there a similar example that we can see?
I attached wireframe of the view.

What is the link to your site?
hidden link

#1516567

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2020-02-19 at 15.37.53.png

Hi there

The first thing to point out is that this will require a taxonomy View, support for which isn't yet added to Toolset Blocks, so you'll need to be familiar with using the classic Views editor for this.

I don't see any debug info for your site so I don't know which plugins you have installed, but if you are using Blocks you don't need to switch to Views, you can just update Toolset > Settings so that both UI's are available.

From your description I think you will want to use taxonomy archives with a taxonomy View to create the dropdown that will allow you to switch between archives.

So, you have a product post type, an "Application" taxonomy, which has top level terms including "Label Papers" that has child terms such as Dairy, Confet, Pet food etc.

For a top-level term such as Label Papers it should display the dropdown with the child terms.

First, let's create the View which will generate the dropdown.

At Toolset > Views create a new View and for the Content Selection choose the Application taxonomy, so that this View will query and return terms of the Application taxonomy.

But we only want the child terms, so add a Query Filter that will specify the parent as coming from the archive where the View is inserted (i.e. "Select taxonomy terms whose parent is the current taxonomy archive").

We will need to use the Loop Editor to generate the markup for the select dropdown, where the option values are the URLs of the child term archives and the display values the names of the child terms. Note how we also include an empty option for a "--Choose--" placeholder. Also, I removed any content between the wpv-no-items-found shortcodes, as if there are no child terms we don't want the select to be generated.

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<select name="tax-child" onChange="window.location.href=this.value">
          <option value="">-- Choose --</option>
		<wpv-loop>
          <option value="[wpv-taxonomy-url]">[wpv-taxonomy-title]</option>
		</wpv-loop>
		</select>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found][/wpv-no-items-found]
[wpv-layout-end]

It will help you understand the above to know that whatever is inside the wpv-loop tags is repeated for every result of the query, i.e. in this case for every child term.

Now for the archive.

Create a new custom archive at Toolset > WordPress Archives which is assigned to the Applications taxonomy.

This will determine what is shown when someone visits a URL such as site.com/applications/label-papers/, i.e. the posts (products) to which the label-papers term of the applications taxonomy are assigned.

If you prefer the Blocks editor you can use that to create this custom archive.

Design the output of the archive as you like.

You'll then want to insert the View with the dropdown above the main archive output.

Because the Block editor doesn't yet support taxonomy Views, you'll want to insert a Classic Block and then use the little Fields and Views button (see screenshot) to insert your View.

Let me know if you get stuck.

#1518585

Hello, maybe I need to better describe, what I need to accomplish.
I use Toolset and Elementor pro to build my pages, also pages are in 3 languages. I use WPML for translations.

I have a custom post type "Products", which has two taxonomies: Product Groups and Product Applications.

I need to create a Toolset View, that will include a dropdown with list of Products Applications taxonomy, and below a grid with product images, product names and links to product pages will appear, depending what you choose from the dropdown (Ajax search inside page). I will then add this Toolset view to different Elelementor page that I created. I uploaded the wireframe yesterday.

The problem is that when I add new View (Display the results using a custom search) to create a dropdown and select Taxonomy "Applications", Custom Search Settings say "Only Views listing posts can have custom search inputs."

Also, I don't want to create whole Archive page for the results, because results will be part of the page builth with Elementor Pro. I will add a Toolset View inside Elementor.

I you want you can take a look inside admin, where can I safely paste login credentials?

#1519081

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

The problem is that when I add new View (Display the results using a custom search) to create a dropdown and select Taxonomy "Applications", Custom Search Settings say "Only Views listing posts can have custom search inputs."

If the purpose of the dropdown is to act as a filter to search product posts by the product applications taxonomy then creating a taxonomy View is the wrong way to go about it.

You create a custom search View to display product posts, and then in the Search and Pagination section you add a new filter for the product applications taxonomy.

That will insert the dropdown that visitors use to choose the product applications to filter product posts by.

Did you try that already? Is that not what you need?

#1528681

My issue is resolved now. Thank you!