add-on facet type
Hierarchy Select
Guided dropdowns, one depth level at a time
This add-on lets you create guided dropdowns based on a hierarchical taxonomy.
Adding the facet
- Create a new facet, and set the
Facet type
toHierarchy select
- Add the facet to your listing page(s)
Available options
Name | Description |
---|---|
Data Source | The taxonomy to pull values from. |
Sort by | Sort facet choices by:
|
Depth {n} labels | Dropdown labels (click “Add Label” button to add more). Note: the depth labels are translatable with the facetwp_i18n hook. |
Important: Remember to re-index each time after a term’s hierarchy changes, e.g. changing to a new parent term.
Hide counts
To hide counts from all facets of a type that use a dropdown UI (all Hierarchy Select facets facets, Dropdown facets, and fSelect facets, and Range List facets (in dropdown or fSelect UI mode)), add the following to your theme’s functions.php:
add_filter( 'facetwp_facet_dropdown_show_counts', '__return_false' );
If you want to hide counts from specific facets with a dropdown UI, then use this instead:
add_filter( 'facetwp_facet_dropdown_show_counts', function( $return, $params ) {
if ( 'your_facet_name' == $params['facet']['name'] ) {
$return = false;
}
return $return;
}, 10, 2 );