Skip Navigation

[Resolved] Split: filter category hierarchy – show only subcategories as filter

This support ticket is created 3 years, 2 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 21 replies, has 2 voices.

Last updated by alexd-6 3 years, 2 months ago.

Assisted by: Minesh.

Author
Posts
#1913035

Hey Minesh,

is it possible to do the Filter on my Productarchiv that i see only the Subkategories to Filter?
Here: hidden link

its a post you gave support -> here: https://toolset.com/forums/topic/set-up-product-archive-with-filter/page/2/

best regards - alex

#1913077

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Do you mean that with your product category archive, you only want to display the sub-categories and hide the top level terms with the frontend filter you added on right hand sidebar?

#1913115
Bildschirmfoto 2021-01-21 um 12.03.12.png

yes i think so - it can be over the result ..

maybe like on Screenshot

#1914445

Hey Minish, you know what i mean?

warmly - alex

#1914465

Minesh
Supporter

Languages: English (English )

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

What if you try to create a taxonomy view and configure it's loop editor section and add whatever things you want to display with your taxonomy view and add the taxonomy view outside your archive's loop.

#1914475
Bildschirmfoto 2021-01-22 um 12.26.04.jpg

Hey - is there an demo or a link where i can see it?

In Archive i cant see a Filter for it:

#1914533

Minesh
Supporter

Languages: English (English )

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

Ahh, you not just want to display the subcategories but you want to also display the filter.

You can not add the Product Category as taxonomy filter to taxonomy archive as one taxonomy archive of term X (that displays the posts belongs to term X) you can not display the term Y posts.

There are couple of workarounds:
1 - Either you can create a "Custom Search" view and add category filter there and add this view to some page.
OR
2 - You can only display the taxonomy term links at top of the page as per your screenshots by creating the taxonomy view.

If you do not know how to do it (2nd), please share access details and I will setup a demo for you.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#1914543

Minesh
Supporter

Languages: English (English )

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

So, Can you please confirm, on this page: hidden link

What categories you want to display (just display link of that category, not the filter):
- Do you want to display top level terms
- Do you want to display 2nd level terms?

#1914551

oh thx - i want to display only 2nd level terms

but best is: show in category alsays same level (sibblings) of categories as filter.

#1914625

Minesh
Supporter

Languages: English (English )

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

I've created the following taxonomy view:
=> hidden link

And added the following filter to "Custom Code" section offered by Toolset:
=> hidden link

function func_display_subcats( $query_settings, $view_settings, $view_id  ){
 global $wp_query;
    if ( $view_id == 523){
       
        $obj = $wp_query->get_queried_object();
        $query_settings['child_of'] = $obj->parent;
       
    }
    return $query_settings;
}
add_filter( 'wpv_filter_taxonomy_query', 'func_display_subcats', 30, 3 );

And the, With your taxonomy archive, within the Loop Editor section I've added the taxonomy view created at top:

[wpv-view name="tax-view-product-cats"]

=> hidden link

You can format the taxonomy view output as required.

#1917217

Hi Minesh,

but on hidden link - i dont see the filter?

What did i have wrong?

Thx a lot for all that - warmly alex

#1917283

Hey - sorry -

does not have the wright subcats in

hidden link

Is it possible to show each entry if category not empty?

best regards - alex

#1918477

Minesh
Supporter

Languages: English (English )

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

The categories are displayed and if you mouse-hover on it you will see it.

There is a conflict where white color is applied to anchor tags. Can you please adjust the color for your anchor tag and you will be able to see the anchor.
=> hidden link

You should adjust that CSS and that will help you to resolve your issue.

#1921749

hi Minesh - no i just changed the css - you can see all if you clear cache,,

but if i switch between the "Main-categorys" - the submenu-filter is not switching too. What is the Problem

Main-Categories are all in first level of navigation menu above.

thx for you help, alex

#1921767

Minesh
Supporter

Languages: English (English )

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

What you mean by switch to main category and where I can see the issue?

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