Terms loop with exclusion

Hello guys,

After hours, I decide to ask you a solution for, to my mind, a stupid issue.

To sum up:

  • I’ve created a CPT ‘Bicycle sheet’ (ACF PRO)
  • I’ve created a taxonomy (ACF PRO) ‘Bicycle categories’.
  • I’ve created a layout archive to display the various listings by ‘Bicycle category’.

All that, it works, it’s great.

In the page I’ve created a loop with an ‘all terms’ provider on ‘Bicycle category’: it works.

Except that I only want the terms ‘sale’ (“vente” in screenshots) and its children (not “Location”)
I’ve tried writing the ‘all terms’ query as a query string and then trying to exclude it… but now I’m going round in circles.
How can I loop over terms with exclusion?

:pray:

Hey @cpennetier,

Thanks for writing in! Instead of using the Looper Provider All Terms, you will need to use the Looper Provider Current Post Terms so that only terms associated with the items will display.

If this is not helping, we would love to check your layout if we can log in. You can create a secure note in your next reply with the following info:
– Link to your site
– WP login URL
– WP username
– WP password
– WP Administrator Role
– Confirmation that we can access and make changes to your site

To know how to create a secure note, please check this out: How The Forum Works

image

Best Regards.

Hi @ruenel,

Thanks for your answer.
I had tested but the problem with the ‘current post terms’ set to ‘bike category’ is :

  • I’m on ‘bike sales’ (the parent category - Level0), I have everything
  • When I click on 1 child category (L1 or L2), I lose the other L1 category and the other L3 categories.

The aim is to always have categories L0 - L1 - L2.

I succeeded with a blog but the same system didn’t work there.
I’ll send you a secure note.

Hello @cpennetier,

Since you want to display the child categories of the parent category/ies, you may need to use the Looper Provider Custom. Please check out these old thread as your guide of how you can return the child categories:

Best Regards.

Hi there,

I’m using Pro Theme with a hierarchical custom taxonomy ( categorie-de-velo ) linked to a custom post type ( fiche-velo ).
On the archive pages of this taxonomy, I wanted to dynamically display the child terms of the parent category , using a Custom Looper Provider that calls a PHP function registered in functions.php .

:x: Issue encountered:

The PHP function is never executed in the taxonomy archive context — even though it’s properly declared and works perfectly outside of it (tested with static debug output).
Functions like get_queried_object() or get_query_var() behave correctly outside the builder, so the issue seems specific to the archive layout context.

:white_check_mark: Workaround:

I created a custom PHP shortcode ( [sous_categories_velo] ) that returns the desired child terms dynamically.
The shortcode is inserted inside a Raw Content Area in the archive layout, and works perfectly — including when browsing child categories.

Thank you for the valuable help and past discussions on the forum — they’ve been a great help throughout the process. :pray:

Glad to know that this has been resolved! Please don’t hesitate to open another thread if you have more questions. Have a nice day.