Skip Navigation

[Resolved] Need a front end filter for a taxonomy view

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

Problem:

Add a taxonomy filter in taxonomy view.

Solution:

You can setup a taxonomy view as the filter, for example:

https://toolset.com/forums/topic/need-a-front-end-filter-for-a-taxonomy-view/#post-1221292

Relevant Documentation:

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
- 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)

Tagged: 

This topic contains 2 replies, has 2 voices.

Last updated by Robert Campbell 5 years ago.

Assisted by: Luo Yang.

Author
Posts
#1221103

I had a second attempt to create a grouped alphabetic view which you can see at hidden link

I have created a parent taxonomy view where the taxonomy terms are the letters of the alphabet.
This calls up a custom post type child view which is filtered by the parent taxonomy.

Here is the parent view code:

[wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
[wpv-taxonomy-title]
[wpv-view name="companys-inner"]
		</wpv-loop>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]

The child "companys-inner" post view uses the filter;
'Select posts with taxonomy:
tax-companys set by the parent Taxonomy View'

This all works very well.

Now I need to find a way to create a front end filter for the parent view, so that the user can decide which letter of the alphabet (so which taxonomy term, they wish to filter by. So imagine a listing of the alphabet;

A B C D E F G H etc

And the user selects which of these terms they wish to filter the displayed posts by.

Taxonomy views do not have custom search fields like post views so I don't understand how to do this. I can see that the taxonomy view does have a taxonomy filter available but I can't see how to present this as a front end filter. Can you help please.

Regards

Robert

#1221292
term-search.JPG

Dear Robert,

Yes, you are right, taxonomy view does not support custom search form.

As a workaround, you can setup a taxonomy view:
- query term's of your custom taxonomy
- in View's loop, display a link to pass term's ID as URL parameter "terms-filter", for example:

<a href='?terms-filter=[wpv-taxonomy-id]'>[wpv-taxonomy-title]</a>

Edit your the existed taxonomy view, add a filter:
Taxonomy term ID is set by the URL parameter "terms-filter", see screenshot term-search.JPG

Then it should be able to do same thing

#1221922

Dear Luo
Your solution worked perfectly thank you. I have also added a hyperlink with text "ALL" to take you back to the unfiltered view. See hidden link
Regards
Robert

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.