Skip Navigation

[Resolved] Filtering by child taxonomy in WordPress Archive

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

Problem:

I would like to have a page for each category (like car, motoribike, truck) so I have chosen WordPress Archives as the easiest way (just to create one archive and it will be used on all the given taxonomy). And what I would like, is to have links to child category. So in URL it would be /car/ and on this page will be list of all the cars and also links to child categories (pickup, SUV,...) and on the child pages there should be links to parent and to other child taxonomy. The children will not have any other children, so it´s only Parent -> Child, not another levels.

Solution:

It needs only one Taxonomy view + one WordPress archive, for example:

https://toolset.com/forums/topic/filtering-by-child-taxonomy-in-wordpress-archive/#post-1233109

Relevant Documentation:

https://toolset.com/documentation/getting-started-with-toolset/customize-post-archives/designing-an-archive-without-any-page-builder/

This support ticket is created 5 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.

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)

This topic contains 12 replies, has 3 voices.

Last updated by toolset-dave 5 years, 8 months ago.

Assisted by: Luo Yang.

Author
Posts
#1231552

Hi,

I am trying to filter WordPress Archive by children taxonomy. See hidden link, but it only displays main parent category, not the children ones.

[wpv-control-post-taxonomy taxonomy="kategorie" type="radios" default_label="All" url_param="wpv-kategorie"]
#1231586

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - the thing is that search filter with taxonomy archive will not work. We already display the notice when you add the filter to taxonomy archive:

This filter will not be applied to Taxonomy Archives matching the filtered taxonomies: 

You will find above message with "Query Filter" section on your taxonomy archive - do you see it? or I misunderstood anything here.

Currently, it's possible to filter a taxonomy term archive based on that same taxonomy, You can say this is a limitation and even its design by WordPress.

#1231712

Hi, when you add this filter no notice will be displayed. You have to reload the whole page to get this notice, so it is visible now. It would be useful if it appear immediatelly.

But it does not solve my problem. So is there any way to achieve this? Like inserting View with child taxonomy?

#1231988

Minesh
Supporter

Languages: English (English )

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

Well - what if you try to create a page where you display parent and child taxonomy with taxonomy filter instead of creating an archive?

Does that help?

#1232078

Hi Minesh, so it means that I have to create a page for each category? Because I would like to have a name of the category in URL, that was the reason why I have chosen to use the archive. Also I want to use the category description.

#1232156

Minesh
Supporter

Languages: English (English )

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

Well - there is no way to insert to filter that displays only child terms of taxonomy.

The only way I can think of is you should create a view with taxonomy filter and add it to your archive "Loop Editor" section as given under just before the [wpv-items-found] shortcode:

[wpv-layout-start]
[wpv-view name="filter-post-by-taxonomy"]
	[wpv-items-found]
	<!-- wpv-loop-start -->
		<wpv-loop>
		</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]

It will display all terms but it will allow you to filter your posts.

#1232227

Thanks, I have followed your recommendation, but as you also wrote, it displays all the terms, which is not what I would like to and also it does not show the description for the taxonomy by the selected taxonomy.

So if I quit the filtering, would it be possible to display just the links to child archives which belong to the parent one (and the opposite)?

#1232242

Minesh
Supporter

Languages: English (English )

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

Well - I have another way to offer you. But it's using views not archives.

the following will be the structure:
PARENT CATEGORY
--- CHILD CATEGORY
--- POST belongs to child category

If this is correct, its 3 levels where:
- PARENT CATEGORY is first level, for that we need to create a taxonomy view
- CHILD CATEGORY is second level, where you need to fetch only child categories whose parent is -(PARENT CATEGORY) first level.
- POST whose parent is (CHILD CATEGORY) second level.

Please check the following related ticket.
-- https://toolset.com/forums/topic/view-to-drilldown-into-taxonomy-and-finally-go-to-search-result-page/#post-948283

will this solution help and fits into your needs?

#1232420

Thanks for the link. Before I begin to follow the steps, I would like to know if each parent and even child category will have own page (for SEO purposes and to be easyly linked) and I can use the taxonomy description?

#1232681

Hello,

Minesh is on vacation, I will take care of this thread.

Please elaborate the question with more details:
I would like to know if each parent and even child category will have own page
Where and how do you want to setup the category own page?

If it is a taxonomy view, you can display the each term's description with shortcode [wpv-taxonomy-description]. see our document:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-description

#1232728
parent-category.png
child-category.png

Hi Luo,

in basics I would like to have a page for each category (like car, motoribike, truck) so I have chosen WordPress Archives as the easiest way (just to create one archive and it will be used on all the given taxonomy). And what I would like, is to have links to child category. So in URL it would be /car/ and on this page will be list of all the cars and also links to child categories (pickup, SUV,...) and on the child pages there should be links to parent and to other child taxonomy. The children will not have any other children, so it´s only Parent -> Child, not another levels. See attachment.

#1233109

Thanks for the details, in your case, it needs only one Taxonomy view + one WordPress archive, for example:

1) You can create a taxonomy view "child-terms":
- Query terms of taxonomy "kategorie"
- filter by:
Select taxonomy terms whose parent is the current taxonomy archive.
- in section "Loop Editor", within Views loop, display term's archive page link:
[wpv-taxonomy-link]
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-link

2) Create a WordPress archive for taxonomy "kategorie"
https://toolset.com/documentation/getting-started-with-toolset/customize-post-archives/designing-an-archive-without-any-page-builder/
in section "Loop Editor", display the taxonomy description field with shortcode:
[wpv-taxonomy-archive info="description"]
+
Above taxonomy view's shortcode:
[wpv-view name="child-terms"]

More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-taxonomy-archive

#1234663

Hi Luo,

thank you, that´s what I wanted.